<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE BangPatterns, CPP, MagicHash, Rank2Types, UnboxedTuples, TypeFamilies #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE TemplateHaskellQuotes #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-orphans #-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      : Data.Text</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan,</span><span>
</span><span id="line-10"></span><span class="hs-comment">--               (c) 2009 Duncan Coutts,</span><span>
</span><span id="line-11"></span><span class="hs-comment">--               (c) 2008, 2009 Tom Harper</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- License     : BSD-style</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  : bos@serpentine.com</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Portability : GHC</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- A time and space-efficient implementation of Unicode text.</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Suitable for performance critical use, both in terms of large data</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- quantities and high speed.</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- /Note/: Read below the synopsis for important notes on the use of</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- this module.</span><span>
</span><span id="line-23"></span><span class="hs-comment">--</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- This module is intended to be imported @qualified@, to avoid name</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- clashes with &quot;Prelude&quot; functions, e.g.</span><span>
</span><span id="line-26"></span><span class="hs-comment">--</span><span>
</span><span id="line-27"></span><span class="hs-comment">-- &gt; import qualified Data.Text as T</span><span>
</span><span id="line-28"></span><span class="hs-comment">--</span><span>
</span><span id="line-29"></span><span class="hs-comment">-- To use an extended and very rich family of functions for working</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- with Unicode text (including normalization, regular expressions,</span><span>
</span><span id="line-31"></span><span class="hs-comment">-- non-standard encodings, text breaking, and locales), see the</span><span>
</span><span id="line-32"></span><span class="hs-comment">-- &lt;http://hackage.haskell.org/package/text-icu text-icu package &gt;.</span><span>
</span><span id="line-33"></span><span class="hs-comment">--</span><span>
</span><span id="line-34"></span><span>
</span><span id="line-35"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Text</span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Strict vs lazy types</span></span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><span class="hs-comment">-- $strict</span></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Acceptable data</span></span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><span class="hs-comment">-- $replacement</span></span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Definition of character</span></span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="hs-comment">-- $character_definition</span></span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Fusion</span></span><span>
</span><span id="line-47"></span><span>    </span><span class="annot"><span class="hs-comment">-- $fusion</span></span><span>
</span><span id="line-48"></span><span>
</span><span id="line-49"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Types</span></span><span>
</span><span id="line-50"></span><span>      </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier">Text</span></a></span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Creation and elimination</span></span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#pack"><span class="hs-identifier">pack</span></a></span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Show.html#unpack"><span class="hs-identifier">unpack</span></a></span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-identifier">singleton</span></a></span><span>
</span><span id="line-56"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span>
</span><span id="line-57"></span><span>
</span><span id="line-58"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Basic interface</span></span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#cons"><span class="hs-identifier">cons</span></a></span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#snoc"><span class="hs-identifier">snoc</span></a></span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#append"><span class="hs-identifier">append</span></a></span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#uncons"><span class="hs-identifier">uncons</span></a></span><span>
</span><span id="line-63"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#unsnoc"><span class="hs-identifier">unsnoc</span></a></span><span>
</span><span id="line-64"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#head"><span class="hs-identifier">head</span></a></span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#last"><span class="hs-identifier">last</span></a></span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#tail"><span class="hs-identifier">tail</span></a></span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#init"><span class="hs-identifier">init</span></a></span><span>
</span><span id="line-68"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#null"><span class="hs-identifier">null</span></a></span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#length"><span class="hs-identifier">length</span></a></span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-identifier">compareLength</span></a></span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Transformations</span></span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#map"><span class="hs-identifier">map</span></a></span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#intercalate"><span class="hs-identifier">intercalate</span></a></span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#transpose"><span class="hs-identifier">transpose</span></a></span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#reverse"><span class="hs-identifier">reverse</span></a></span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#replace"><span class="hs-identifier">replace</span></a></span><span>
</span><span id="line-79"></span><span>
</span><span id="line-80"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Case conversion</span></span><span>
</span><span id="line-81"></span><span>    </span><span class="annot"><span class="hs-comment">-- $case</span></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#toCaseFold"><span class="hs-identifier">toCaseFold</span></a></span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#toLower"><span class="hs-identifier">toLower</span></a></span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#toUpper"><span class="hs-identifier">toUpper</span></a></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#toTitle"><span class="hs-identifier">toTitle</span></a></span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Justification</span></span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#justifyLeft"><span class="hs-identifier">justifyLeft</span></a></span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#justifyRight"><span class="hs-identifier">justifyRight</span></a></span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#center"><span class="hs-identifier">center</span></a></span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Folds</span></span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldl"><span class="hs-identifier">foldl</span></a></span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldl%27"><span class="hs-identifier">foldl'</span></a></span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldl1"><span class="hs-identifier">foldl1</span></a></span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldl1%27"><span class="hs-identifier">foldl1'</span></a></span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldr"><span class="hs-identifier">foldr</span></a></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#foldr1"><span class="hs-identifier">foldr1</span></a></span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Special folds</span></span><span>
</span><span id="line-101"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#concat"><span class="hs-identifier">concat</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#any"><span class="hs-identifier">any</span></a></span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#all"><span class="hs-identifier">all</span></a></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#maximum"><span class="hs-identifier">maximum</span></a></span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#minimum"><span class="hs-identifier">minimum</span></a></span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Construction</span></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Scans</span></span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#scanl"><span class="hs-identifier">scanl</span></a></span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#scanl1"><span class="hs-identifier">scanl1</span></a></span><span>
</span><span id="line-113"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#scanr"><span class="hs-identifier">scanr</span></a></span><span>
</span><span id="line-114"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#scanr1"><span class="hs-identifier">scanr1</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Accumulating maps</span></span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#mapAccumL"><span class="hs-identifier">mapAccumL</span></a></span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#mapAccumR"><span class="hs-identifier">mapAccumR</span></a></span><span>
</span><span id="line-119"></span><span>
</span><span id="line-120"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Generation and unfolding</span></span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#replicate"><span class="hs-identifier">replicate</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#unfoldr"><span class="hs-identifier">unfoldr</span></a></span><span>
</span><span id="line-123"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#unfoldrN"><span class="hs-identifier">unfoldrN</span></a></span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Substrings</span></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Breaking strings</span></span><span>
</span><span id="line-128"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#take"><span class="hs-identifier">take</span></a></span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#takeEnd"><span class="hs-identifier">takeEnd</span></a></span><span>
</span><span id="line-130"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-identifier">drop</span></a></span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#dropEnd"><span class="hs-identifier">dropEnd</span></a></span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#takeWhile"><span class="hs-identifier">takeWhile</span></a></span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#takeWhileEnd"><span class="hs-identifier">takeWhileEnd</span></a></span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#dropWhile"><span class="hs-identifier">dropWhile</span></a></span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#dropWhileEnd"><span class="hs-identifier">dropWhileEnd</span></a></span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#dropAround"><span class="hs-identifier">dropAround</span></a></span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#strip"><span class="hs-identifier">strip</span></a></span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#stripStart"><span class="hs-identifier">stripStart</span></a></span><span>
</span><span id="line-139"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#stripEnd"><span class="hs-identifier">stripEnd</span></a></span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#splitAt"><span class="hs-identifier">splitAt</span></a></span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#breakOn"><span class="hs-identifier">breakOn</span></a></span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#breakOnEnd"><span class="hs-identifier">breakOnEnd</span></a></span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#break"><span class="hs-identifier">break</span></a></span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#span"><span class="hs-identifier">span</span></a></span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#group"><span class="hs-identifier">group</span></a></span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#groupBy"><span class="hs-identifier">groupBy</span></a></span><span>
</span><span id="line-147"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#inits"><span class="hs-identifier">inits</span></a></span><span>
</span><span id="line-148"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#tails"><span class="hs-identifier">tails</span></a></span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Breaking into many substrings</span></span><span>
</span><span id="line-151"></span><span>    </span><span class="annot"><span class="hs-comment">-- $split</span></span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#splitOn"><span class="hs-identifier">splitOn</span></a></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#split"><span class="hs-identifier">split</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#chunksOf"><span class="hs-identifier">chunksOf</span></a></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Breaking into lines and words</span></span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#lines"><span class="hs-identifier">lines</span></a></span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-comment">--, lines'</span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#words"><span class="hs-identifier">words</span></a></span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#unlines"><span class="hs-identifier">unlines</span></a></span><span>
</span><span id="line-161"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#unwords"><span class="hs-identifier">unwords</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Predicates</span></span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#isPrefixOf"><span class="hs-identifier">isPrefixOf</span></a></span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#isSuffixOf"><span class="hs-identifier">isSuffixOf</span></a></span><span>
</span><span id="line-166"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#isInfixOf"><span class="hs-identifier">isInfixOf</span></a></span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** View patterns</span></span><span>
</span><span id="line-169"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#stripPrefix"><span class="hs-identifier">stripPrefix</span></a></span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#stripSuffix"><span class="hs-identifier">stripSuffix</span></a></span><span>
</span><span id="line-171"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#commonPrefixes"><span class="hs-identifier">commonPrefixes</span></a></span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Searching</span></span><span>
</span><span id="line-174"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#filter"><span class="hs-identifier">filter</span></a></span><span>
</span><span id="line-175"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#breakOnAll"><span class="hs-identifier">breakOnAll</span></a></span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#find"><span class="hs-identifier">find</span></a></span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#elem"><span class="hs-identifier">elem</span></a></span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#partition"><span class="hs-identifier">partition</span></a></span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-comment">-- , findSubstring</span><span>
</span><span id="line-181"></span><span>
</span><span id="line-182"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Indexing</span></span><span>
</span><span id="line-183"></span><span>    </span><span class="annot"><span class="hs-comment">-- $index</span></span><span>
</span><span id="line-184"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#index"><span class="hs-identifier">index</span></a></span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#findIndex"><span class="hs-identifier">findIndex</span></a></span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#count"><span class="hs-identifier">count</span></a></span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Zipping</span></span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#zip"><span class="hs-identifier">zip</span></a></span><span>
</span><span id="line-190"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#zipWith"><span class="hs-identifier">zipWith</span></a></span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-comment">-- -* Ordered text</span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-comment">-- , sort</span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Low level operations</span></span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.html#copy"><span class="hs-identifier">copy</span></a></span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Show.html#unpackCString%23"><span class="hs-identifier">unpackCString#</span></a></span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier">Char</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier">Bool</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier">Int</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier">Maybe</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier">String</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-201"></span><span>                </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier">Eq</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier">Ord</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Ordering"><span class="hs-identifier">Ordering</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator">(++)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-202"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier">Read</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-203"></span><span>                </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator">(&amp;&amp;)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator">(||)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator">(+)</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">-</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#."><span class="hs-operator">(.)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator">($)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator">($!)</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator">(&gt;&gt;)</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-204"></span><span>                </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier">not</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier">return</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier">otherwise</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Real.html#quot"><span class="hs-identifier">quot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#"><span class="hs-identifier">Control.DeepSeq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier">NFData</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#rnf"><span class="hs-identifier">rnf</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Exception</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">assert</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">GHC.Stack</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HasCallStack</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Char.html#"><span class="hs-identifier">Data.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier">isSpace</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#"><span class="hs-identifier">Data.Data</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier">Data</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Data.html#gfoldl"><span class="hs-identifier">gfoldl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#toConstr"><span class="hs-identifier">toConstr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#gunfold"><span class="hs-identifier">gunfold</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#dataTypeOf"><span class="hs-identifier">dataTypeOf</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#constrIndex"><span class="hs-identifier">constrIndex</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-212"></span><span>                  </span><span class="annot"><a href="../../base/src/Data.Data.html#Constr"><span class="hs-identifier">Constr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#mkConstr"><span class="hs-identifier">mkConstr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#DataType"><span class="hs-identifier">DataType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#mkDataType"><span class="hs-identifier">mkDataType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Fixity"><span class="hs-identifier">Fixity</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Data.html#Prefix"><span class="hs-identifier">Prefix</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-213"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier">foldM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-214"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.ST.html#"><span class="hs-identifier">Control.Monad.ST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier">ST</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-215"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Array.html"><span class="hs-identifier">Data.Text.Array</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">A</span></span><span>
</span><span id="line-216"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>
</span><span id="line-217"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.html#"><span class="hs-identifier">Data.Binary</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#Binary"><span class="hs-identifier">Binary</span></a></span><span class="hs-special">(</span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#get"><span class="hs-identifier">get</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#put"><span class="hs-identifier">put</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Monoid.html#"><span class="hs-identifier">Data.Monoid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier">Monoid</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-219"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier">Semigroup</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#"><span class="hs-identifier">Data.String</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier">IsString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-221"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html"><span class="hs-identifier">Data.Text.Internal.Fusion</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-222"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html"><span class="hs-identifier">Data.Text.Internal.Fusion.Common</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span>
</span><span id="line-223"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Encoding.html"><span class="hs-identifier">Data.Text.Encoding</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Encoding.html#decodeUtf8%27"><span class="hs-identifier">decodeUtf8'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Encoding.html#encodeUtf8"><span class="hs-identifier">encodeUtf8</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-224"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html"><span class="hs-identifier">Data.Text.Internal.Fusion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier">stream</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#reverseStream"><span class="hs-identifier">reverseStream</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier">unstream</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Private.html"><span class="hs-identifier">Data.Text.Internal.Private</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Private.html#span_"><span class="hs-identifier">span_</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.html"><span class="hs-identifier">Data.Text.Internal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier">Text</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#empty"><span class="hs-identifier">empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier">firstf</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#mul"><span class="hs-identifier">mul</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#safe"><span class="hs-keyword">safe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#text"><span class="hs-identifier">text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Show.html"><span class="hs-identifier">Data.Text.Show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-identifier">singleton</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Show.html#unpack"><span class="hs-identifier">unpack</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Show.html#unpackCString%23"><span class="hs-identifier">unpackCString#</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Prelude.html#"><span class="hs-identifier">Prelude</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">P</span></span><span>
</span><span id="line-229"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html"><span class="hs-identifier">Data.Text.Unsafe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier">Iter</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier">iter</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#iter_"><span class="hs-identifier">iter_</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#lengthWord16"><span class="hs-identifier">lengthWord16</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#reverseIter"><span class="hs-identifier">reverseIter</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-230"></span><span>                         </span><span class="annot"><a href="Data.Text.Unsafe.html#reverseIter_"><span class="hs-identifier">reverseIter_</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier">unsafeHead</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#unsafeTail"><span class="hs-identifier">unsafeTail</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-231"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Char</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier">unsafeChr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Functions.html"><span class="hs-identifier">Data.Text.Internal.Functions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">F</span></span><span>
</span><span id="line-233"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.Text.Internal.Encoding.Utf16.html"><span class="hs-identifier">Data.Text.Internal.Encoding.Utf16</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">U16</span></span><span>
</span><span id="line-234"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Search.html"><span class="hs-identifier">Data.Text.Internal.Search</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier">indices</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Text.Internal.Unsafe.Shift.html"><span class="hs-identifier">Data.Text.Internal.Unsafe.Shift</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.Unsafe.Shift.html#UnsafeShift"><span class="hs-identifier">UnsafeShift</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#if defined(__HADDOCK__)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.ByteString</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ByteString</span><span class="hs-special">)</span><span>
</span><span id="line-238"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="hs-identifier">Data.Text.Lazy</span><span> </span><span class="hs-keyword">as</span><span> </span><span class="hs-identifier">L</span><span>
</span><span id="line-239"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Int</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Int64</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#"><span class="hs-identifier">GHC.Base</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#eqInt"><span class="hs-identifier">eqInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#neInt"><span class="hs-identifier">neInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#gtInt"><span class="hs-identifier">gtInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#geInt"><span class="hs-identifier">geInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#ltInt"><span class="hs-identifier">ltInt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#leInt"><span class="hs-identifier">leInt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-242"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/GHC.Exts.html#"><span class="hs-identifier">GHC.Exts</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Exts</span></span><span>
</span><span id="line-243"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../template-haskell/src/Language.Haskell.TH.Lib.html#"><span class="hs-identifier">Language.Haskell.TH.Lib</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">TH</span></span><span>
</span><span id="line-244"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#"><span class="hs-identifier">Language.Haskell.TH.Syntax</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">TH</span></span><span>
</span><span id="line-245"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Text.Printf.html#"><span class="hs-identifier">Text.Printf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Text.Printf.html#PrintfArg"><span class="hs-identifier">PrintfArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Text.Printf.html#formatArg"><span class="hs-identifier">formatArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Text.Printf.html#formatString"><span class="hs-identifier">formatString</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span class="hs-comment">-- $setup</span><span>
</span><span id="line-248"></span><span class="hs-comment">-- &gt;&gt;&gt; import Data.Text</span><span>
</span><span id="line-249"></span><span class="hs-comment">-- &gt;&gt;&gt; import qualified Data.Text as T</span><span>
</span><span id="line-250"></span><span class="hs-comment">-- &gt;&gt;&gt; :seti -XOverloadedStrings</span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span class="hs-comment">-- $character_definition</span><span>
</span><span id="line-253"></span><span class="hs-comment">--</span><span>
</span><span id="line-254"></span><span class="hs-comment">-- This package uses the term /character/ to denote Unicode /code points/.</span><span>
</span><span id="line-255"></span><span class="hs-comment">--</span><span>
</span><span id="line-256"></span><span class="hs-comment">-- Note that this is not the same thing as a grapheme (e.g. a</span><span>
</span><span id="line-257"></span><span class="hs-comment">-- composition of code points that form one visual symbol). For</span><span>
</span><span id="line-258"></span><span class="hs-comment">-- instance, consider the grapheme \&quot;&amp;#x00e4;\&quot;. This symbol has two</span><span>
</span><span id="line-259"></span><span class="hs-comment">-- Unicode representations: a single code-point representation</span><span>
</span><span id="line-260"></span><span class="hs-comment">-- @U+00E4@ (the @LATIN SMALL LETTER A WITH DIAERESIS@ code point),</span><span>
</span><span id="line-261"></span><span class="hs-comment">-- and a two code point representation @U+0061@ (the \&quot;@A@\&quot; code</span><span>
</span><span id="line-262"></span><span class="hs-comment">-- point) and @U+0308@ (the @COMBINING DIAERESIS@ code point).</span><span>
</span><span id="line-263"></span><span>
</span><span id="line-264"></span><span class="hs-comment">-- $strict</span><span>
</span><span id="line-265"></span><span class="hs-comment">--</span><span>
</span><span id="line-266"></span><span class="hs-comment">-- This package provides both strict and lazy 'Text' types.  The</span><span>
</span><span id="line-267"></span><span class="hs-comment">-- strict type is provided by the &quot;Data.Text&quot; module, while the lazy</span><span>
</span><span id="line-268"></span><span class="hs-comment">-- type is provided by the &quot;Data.Text.Lazy&quot; module. Internally, the</span><span>
</span><span id="line-269"></span><span class="hs-comment">-- lazy @Text@ type consists of a list of strict chunks.</span><span>
</span><span id="line-270"></span><span class="hs-comment">--</span><span>
</span><span id="line-271"></span><span class="hs-comment">-- The strict 'Text' type requires that an entire string fit into</span><span>
</span><span id="line-272"></span><span class="hs-comment">-- memory at once.  The lazy 'Data.Text.Lazy.Text' type is capable of</span><span>
</span><span id="line-273"></span><span class="hs-comment">-- streaming strings that are larger than memory using a small memory</span><span>
</span><span id="line-274"></span><span class="hs-comment">-- footprint.  In many cases, the overhead of chunked streaming makes</span><span>
</span><span id="line-275"></span><span class="hs-comment">-- the lazy 'Data.Text.Lazy.Text' type slower than its strict</span><span>
</span><span id="line-276"></span><span class="hs-comment">-- counterpart, but this is not always the case.  Sometimes, the time</span><span>
</span><span id="line-277"></span><span class="hs-comment">-- complexity of a function in one module may be different from the</span><span>
</span><span id="line-278"></span><span class="hs-comment">-- other, due to their differing internal structures.</span><span>
</span><span id="line-279"></span><span class="hs-comment">--</span><span>
</span><span id="line-280"></span><span class="hs-comment">-- Each module provides an almost identical API, with the main</span><span>
</span><span id="line-281"></span><span class="hs-comment">-- difference being that the strict module uses 'Int' values for</span><span>
</span><span id="line-282"></span><span class="hs-comment">-- lengths and counts, while the lazy module uses 'Data.Int.Int64'</span><span>
</span><span id="line-283"></span><span class="hs-comment">-- lengths.</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span class="hs-comment">-- $replacement</span><span>
</span><span id="line-286"></span><span class="hs-comment">--</span><span>
</span><span id="line-287"></span><span class="hs-comment">-- A 'Text' value is a sequence of Unicode scalar values, as defined</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- in</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- &lt;http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=35 &#167;3.9, definition D76 of the Unicode 5.2 standard &gt;.</span><span>
</span><span id="line-290"></span><span class="hs-comment">-- As such, a 'Text' cannot contain values in the range U+D800 to</span><span>
</span><span id="line-291"></span><span class="hs-comment">-- U+DFFF inclusive. Haskell implementations admit all Unicode code</span><span>
</span><span id="line-292"></span><span class="hs-comment">-- points</span><span>
</span><span id="line-293"></span><span class="hs-comment">-- (&lt;http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#page=13 &#167;3.4, definition D10 &gt;)</span><span>
</span><span id="line-294"></span><span class="hs-comment">-- as 'Char' values, including code points from this invalid range.</span><span>
</span><span id="line-295"></span><span class="hs-comment">-- This means that there are some 'Char' values that are not valid</span><span>
</span><span id="line-296"></span><span class="hs-comment">-- Unicode scalar values, and the functions in this module must handle</span><span>
</span><span id="line-297"></span><span class="hs-comment">-- those cases.</span><span>
</span><span id="line-298"></span><span class="hs-comment">--</span><span>
</span><span id="line-299"></span><span class="hs-comment">-- Within this module, many functions construct a 'Text' from one or</span><span>
</span><span id="line-300"></span><span class="hs-comment">-- more 'Char' values. Those functions will substitute 'Char' values</span><span>
</span><span id="line-301"></span><span class="hs-comment">-- that are not valid Unicode scalar values with the replacement</span><span>
</span><span id="line-302"></span><span class="hs-comment">-- character \&quot;&amp;#xfffd;\&quot; (U+FFFD).  Functions that perform this</span><span>
</span><span id="line-303"></span><span class="hs-comment">-- inspection and replacement are documented with the phrase</span><span>
</span><span id="line-304"></span><span class="hs-comment">-- \&quot;Performs replacement on invalid scalar values\&quot;.</span><span>
</span><span id="line-305"></span><span class="hs-comment">--</span><span>
</span><span id="line-306"></span><span class="hs-comment">-- (One reason for this policy of replacement is that internally, a</span><span>
</span><span id="line-307"></span><span class="hs-comment">-- 'Text' value is represented as packed UTF-16 data. Values in the</span><span>
</span><span id="line-308"></span><span class="hs-comment">-- range U+D800 through U+DFFF are used by UTF-16 to denote surrogate</span><span>
</span><span id="line-309"></span><span class="hs-comment">-- code points, and so cannot be represented. The functions replace</span><span>
</span><span id="line-310"></span><span class="hs-comment">-- invalid scalar values, instead of dropping them, as a security</span><span>
</span><span id="line-311"></span><span class="hs-comment">-- measure. For details, see</span><span>
</span><span id="line-312"></span><span class="hs-comment">-- &lt;http://unicode.org/reports/tr36/#Deletion_of_Noncharacters Unicode Technical Report 36, &#167;3.5 &gt;.)</span><span>
</span><span id="line-313"></span><span>
</span><span id="line-314"></span><span class="hs-comment">-- $fusion</span><span>
</span><span id="line-315"></span><span class="hs-comment">--</span><span>
</span><span id="line-316"></span><span class="hs-comment">-- Most of the functions in this module are subject to /fusion/,</span><span>
</span><span id="line-317"></span><span class="hs-comment">-- meaning that a pipeline of such functions will usually allocate at</span><span>
</span><span id="line-318"></span><span class="hs-comment">-- most one 'Text' value.</span><span>
</span><span id="line-319"></span><span class="hs-comment">--</span><span>
</span><span id="line-320"></span><span class="hs-comment">-- As an example, consider the following pipeline:</span><span>
</span><span id="line-321"></span><span class="hs-comment">--</span><span>
</span><span id="line-322"></span><span class="hs-comment">-- &gt; import Data.Text as T</span><span>
</span><span id="line-323"></span><span class="hs-comment">-- &gt; import Data.Text.Encoding as E</span><span>
</span><span id="line-324"></span><span class="hs-comment">-- &gt; import Data.ByteString (ByteString)</span><span>
</span><span id="line-325"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- &gt; countChars :: ByteString -&gt; Int</span><span>
</span><span id="line-327"></span><span class="hs-comment">-- &gt; countChars = T.length . T.toUpper . E.decodeUtf8</span><span>
</span><span id="line-328"></span><span class="hs-comment">--</span><span>
</span><span id="line-329"></span><span class="hs-comment">-- From the type signatures involved, this looks like it should</span><span>
</span><span id="line-330"></span><span class="hs-comment">-- allocate one 'Data.ByteString.ByteString' value, and two 'Text'</span><span>
</span><span id="line-331"></span><span class="hs-comment">-- values. However, when a module is compiled with optimisation</span><span>
</span><span id="line-332"></span><span class="hs-comment">-- enabled under GHC, the two intermediate 'Text' values will be</span><span>
</span><span id="line-333"></span><span class="hs-comment">-- optimised away, and the function will be compiled down to a single</span><span>
</span><span id="line-334"></span><span class="hs-comment">-- loop over the source 'Data.ByteString.ByteString'.</span><span>
</span><span id="line-335"></span><span class="hs-comment">--</span><span>
</span><span id="line-336"></span><span class="hs-comment">-- Functions that can be fused by the compiler are documented with the</span><span>
</span><span id="line-337"></span><span class="hs-comment">-- phrase \&quot;Subject to fusion\&quot;.</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110734"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-340"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110730"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110730"><span class="hs-identifier hs-var">arrA</span></a></span></span><span> </span><span id="local-6989586621679110729"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110729"><span class="hs-identifier hs-var">offA</span></a></span></span><span> </span><span id="local-6989586621679110728"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110728"><span class="hs-identifier hs-var">lenA</span></a></span></span><span> </span><span id="local-6989586621679110727"><span class="annot"><span class="annottext">== :: Text -&gt; Text -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></a></span></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110726"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110726"><span class="hs-identifier hs-var">arrB</span></a></span></span><span> </span><span id="local-6989586621679110725"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110725"><span class="hs-identifier hs-var">offB</span></a></span></span><span> </span><span id="local-6989586621679110724"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110724"><span class="hs-identifier hs-var">lenB</span></a></span></span><span>
</span><span id="line-341"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110728"><span class="hs-identifier hs-var">lenA</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110724"><span class="hs-identifier hs-var">lenB</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; Bool
</span><a href="Data.Text.Array.html#equal"><span class="hs-identifier hs-var">A.equal</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110730"><span class="hs-identifier hs-var">arrA</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110729"><span class="hs-identifier hs-var">offA</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110726"><span class="hs-identifier hs-var">arrB</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110725"><span class="hs-identifier hs-var">offB</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110728"><span class="hs-identifier hs-var">lenA</span></a></span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#False"><span class="hs-identifier hs-var">False</span></a></span><span>
</span><span id="line-343"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">==</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-344"></span><span>
</span><span id="line-345"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110708"><span id="local-6989586621679110710"><span id="local-6989586621679110712"><span id="local-6989586621679110714"><span id="local-6989586621679110716"><span id="local-6989586621679110718"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-346"></span><span>    </span><span id="local-6989586621679110706"><span class="annot"><span class="annottext">compare :: Text -&gt; Text -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-identifier hs-var hs-var hs-var hs-var">compare</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Ordering
</span><a href="Data.Text.html#compareText"><span class="hs-identifier hs-var">compareText</span></a></span><span>
</span><span id="line-347"></span><span>
</span><span id="line-348"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110697"><span id="local-6989586621679110699"><span id="local-6989586621679110701"><span class="annot"><a href="../../base/src/GHC.Read.html#Read"><span class="hs-identifier hs-type">Read</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-349"></span><span>    </span><span id="local-6989586621679110691"><span class="annot"><span class="annottext">readsPrec :: Int -&gt; ReadS Text
</span><a href="../../base/src/GHC.Read.html#readsPrec"><span class="hs-identifier hs-var hs-var hs-var hs-var">readsPrec</span></a></span></span><span> </span><span id="local-6989586621679110689"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110689"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110688"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110688"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110687"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110686"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110687"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110687"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110686"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110686"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ReadS String
forall a. Read a =&gt; Int -&gt; ReadS a
</span><a href="../../base/src/GHC.Read.html#readsPrec"><span class="hs-identifier hs-var">readsPrec</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110689"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679110688"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span class="hs-comment">-- | @since 1.2.2.0</span><span>
</span><span id="line-352"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110681"><span id="local-6989586621679110683"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semigroup</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-353"></span><span>    </span><span id="local-6989586621679110679"><span class="annot"><span class="annottext">&lt;&gt; :: Text -&gt; Text -&gt; Text
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">(&lt;&gt;)</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-identifier hs-var">append</span></a></span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-356"></span><span>    </span><span id="local-6989586621679110671"><span class="annot"><span class="annottext">mempty :: Text
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-357"></span><span>    </span><span id="local-6989586621679110669"><span class="annot"><span class="annottext">mappend :: Text -&gt; Text -&gt; Text
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(&lt;&gt;)</span></a></span><span>
</span><span id="line-358"></span><span>    </span><span id="local-6989586621679110668"><span class="annot"><span class="annottext">mconcat :: [Text] -&gt; Text
</span><a href="../../base/src/GHC.Base.html#mconcat"><span class="hs-identifier hs-var hs-var hs-var hs-var">mconcat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Text
</span><a href="Data.Text.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier hs-type">IsString</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-361"></span><span>    </span><span id="local-6989586621679110664"><span class="annot"><span class="annottext">fromString :: String -&gt; Text
</span><a href="../../base/src/Data.String.html#fromString"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="hs-comment">-- | @since 1.2.0.0</span><span>
</span><span id="line-364"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110661"><span class="annot"><a href="../../base/src/GHC.Exts.html#IsList"><span class="hs-identifier hs-type">Exts.IsList</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-365"></span><span>    </span><span class="hs-keyword">type</span><span> </span><span id="Item"><span class="annot"><a href="../../base/src/GHC.Exts.html#Item"><span class="hs-identifier hs-var">Item</span></a></span></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-366"></span><span>    </span><span id="local-6989586621679110658"><span class="annot"><span class="annottext">fromList :: [Item Text] -&gt; Text
</span><a href="../../base/src/GHC.Exts.html#fromList"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromList</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
[Item Text] -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span>
</span><span id="line-367"></span><span>    </span><span id="local-6989586621679110657"><span class="annot"><span class="annottext">toList :: Text -&gt; [Item Text]
</span><a href="../../base/src/GHC.Exts.html#toList"><span class="hs-identifier hs-var hs-var hs-var hs-var">toList</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; String
Text -&gt; [Item Text]
</span><a href="Data.Text.Show.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../deepseq/src/Control.DeepSeq.html#NFData"><span class="hs-identifier hs-type">NFData</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110653"><span class="annot"><span class="annottext">rnf :: Text -&gt; ()
</span><a href="#local-6989586621679110653"><span class="hs-identifier hs-var hs-var hs-var hs-var">rnf</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><span class="annottext">Text
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="hs-comment">-- | @since 1.2.1.0</span><span>
</span><span id="line-372"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110649"><span class="annot"><a href="../../binary/src/Data.Binary.Class.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-373"></span><span>    </span><span id="local-6989586621679110645"><span class="annot"><span class="annottext">put :: Text -&gt; Put
</span><a href="#local-6989586621679110645"><span class="hs-identifier hs-var hs-var hs-var hs-var">put</span></a></span></span><span> </span><span id="local-6989586621679110644"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110644"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Put
forall t. Binary t =&gt; t -&gt; Put
</span><a href="../../binary/src/Data.Binary.Class.html#put"><span class="hs-identifier hs-var">put</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; ByteString
</span><a href="Data.Text.Encoding.html#encodeUtf8"><span class="hs-identifier hs-var">encodeUtf8</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110644"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-374"></span><span>    </span><span id="local-6989586621679110635"><span class="annot"><span class="annottext">get :: Get Text
</span><a href="#local-6989586621679110635"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-375"></span><span>      </span><span id="local-6989586621679110634"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679110634"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Get ByteString
forall t. Binary t =&gt; Get t
</span><a href="../../binary/src/Data.Binary.Class.html#get"><span class="hs-identifier hs-var">get</span></a></span><span>
</span><span id="line-376"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Either UnicodeException Text
</span><a href="Data.Text.Encoding.html#decodeUtf8%27"><span class="hs-identifier hs-var">decodeUtf8'</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621679110634"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-377"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">P.Left</span></a></span><span> </span><span id="local-6989586621679110633"><span class="annot"><span class="annottext">UnicodeException
</span><a href="#local-6989586621679110633"><span class="hs-identifier hs-var">exn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Get Text
forall (m :: * -&gt; *) a. MonadFail m =&gt; String -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">P.fail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UnicodeException -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">P.show</span></a></span><span> </span><span class="annot"><span class="annottext">UnicodeException
</span><a href="#local-6989586621679110633"><span class="hs-identifier hs-var">exn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-378"></span><span>        </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">P.Right</span></a></span><span> </span><span id="local-6989586621679110631"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110631"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Get Text
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">P.return</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110631"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-379"></span><span>
</span><span id="line-380"></span><span class="hs-comment">-- | This instance preserves data abstraction at the cost of inefficiency.</span><span>
</span><span id="line-381"></span><span class="hs-comment">-- We omit reflection services for the sake of data abstraction.</span><span>
</span><span id="line-382"></span><span class="hs-comment">--</span><span>
</span><span id="line-383"></span><span class="hs-comment">-- This instance was created by copying the updated behavior of</span><span>
</span><span id="line-384"></span><span class="hs-comment">-- @&quot;Data.Set&quot;.@'Data.Set.Set' and @&quot;Data.Map&quot;.@'Data.Map.Map'. If you</span><span>
</span><span id="line-385"></span><span class="hs-comment">-- feel a mistake has been made, please feel free to submit</span><span>
</span><span id="line-386"></span><span class="hs-comment">-- improvements.</span><span>
</span><span id="line-387"></span><span class="hs-comment">--</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- The original discussion is archived here:</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- &lt;https://mail.haskell.org/pipermail/haskell-cafe/2010-January/072379.html could we get a Data instance for Data.Text.Text? &gt;</span><span>
</span><span id="line-390"></span><span class="hs-comment">--</span><span>
</span><span id="line-391"></span><span class="hs-comment">-- The followup discussion that changed the behavior of 'Data.Set.Set'</span><span>
</span><span id="line-392"></span><span class="hs-comment">-- and 'Data.Map.Map' is archived here:</span><span>
</span><span id="line-393"></span><span class="hs-comment">-- &lt;http://markmail.org/message/trovdc6zkphyi3cr#query:+page:1+mid:a46der3iacwjcf6n+state:results Proposal: Allow gunfold for Data.Map, ... &gt;</span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110605"><span id="local-6989586621679110607"><span id="local-6989586621679110609"><span id="local-6989586621679110611"><span id="local-6989586621679110613"><span id="local-6989586621679110615"><span id="local-6989586621679110617"><span id="local-6989586621679110619"><span id="local-6989586621679110621"><span id="local-6989586621679110623"><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-396"></span><span>  </span><span id="local-6989586621679110599"><span class="annot"><span class="annottext">gfoldl :: forall (c :: * -&gt; *).
(forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b)
-&gt; (forall g. g -&gt; c g) -&gt; Text -&gt; c Text
</span><a href="#local-6989586621679110599"><span class="hs-identifier hs-var hs-var hs-var hs-var">gfoldl</span></a></span></span><span> </span><span id="local-6989586621679110598"><span class="annot"><span class="annottext">forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679110598"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110597"><span class="annot"><span class="annottext">forall g. g -&gt; c g
</span><a href="#local-6989586621679110597"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110596"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110596"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; c (String -&gt; Text)
forall g. g -&gt; c g
</span><a href="#local-6989586621679110597"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="annot"><span class="annottext">c (String -&gt; Text) -&gt; String -&gt; c Text
forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621679110598"><span class="hs-operator hs-var">`f`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; String
</span><a href="Data.Text.Show.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110596"><span class="hs-identifier hs-var">txt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-397"></span><span>  </span><span id="local-6989586621679110595"><span class="annot"><span class="annottext">toConstr :: Text -&gt; Constr
</span><a href="#local-6989586621679110595"><span class="hs-identifier hs-var hs-var hs-var hs-var">toConstr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Text
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Constr
</span><a href="Data.Text.html#packConstr"><span class="hs-identifier hs-var">packConstr</span></a></span><span>
</span><span id="line-398"></span><span>  </span><span id="local-6989586621679110587"><span class="annot"><span class="annottext">gunfold :: forall (c :: * -&gt; *).
(forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r)
-&gt; (forall r. r -&gt; c r) -&gt; Constr -&gt; c Text
</span><a href="#local-6989586621679110587"><span class="hs-identifier hs-var hs-var hs-var hs-var">gunfold</span></a></span></span><span> </span><span id="local-6989586621679110586"><span class="annot"><span class="annottext">forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><a href="#local-6989586621679110586"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110585"><span class="annot"><span class="annottext">forall r. r -&gt; c r
</span><a href="#local-6989586621679110585"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110584"><span class="annot"><span class="annottext">Constr
</span><a href="#local-6989586621679110584"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Constr -&gt; Int
</span><a href="../../base/src/Data.Data.html#constrIndex"><span class="hs-identifier hs-var">constrIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Constr
</span><a href="#local-6989586621679110584"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-399"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">c (String -&gt; Text) -&gt; c Text
forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><a href="#local-6989586621679110586"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; c (String -&gt; Text)
forall r. r -&gt; c r
</span><a href="#local-6989586621679110585"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-400"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; c Text
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">P.error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;gunfold&quot;</span></span><span>
</span><span id="line-401"></span><span>  </span><span id="local-6989586621679110582"><span class="annot"><span class="annottext">dataTypeOf :: Text -&gt; DataType
</span><a href="#local-6989586621679110582"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataTypeOf</span></a></span></span><span> </span><span class="annot"><span class="annottext">Text
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="Data.Text.html#textDataType"><span class="hs-identifier hs-var">textDataType</span></a></span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span class="hs-comment">-- | This instance has similar considerations to the 'Data' instance:</span><span>
</span><span id="line-404"></span><span class="hs-comment">-- it preserves abstraction at the cost of inefficiency.</span><span>
</span><span id="line-405"></span><span class="hs-comment">--</span><span>
</span><span id="line-406"></span><span class="hs-comment">-- @since 1.2.4.0</span><span>
</span><span id="line-407"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#Lift"><span class="hs-identifier hs-type">TH.Lift</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-408"></span><span>  </span><span id="local-6989586621679110572"><span class="annot"><span class="annottext">lift :: forall (m :: * -&gt; *). Quote m =&gt; Text -&gt; m Exp
</span><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#lift"><span class="hs-identifier hs-var hs-var hs-var hs-var">lift</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m Exp -&gt; m Exp -&gt; m Exp
forall (m :: * -&gt; *). Quote m =&gt; m Exp -&gt; m Exp -&gt; m Exp
</span><a href="../../template-haskell/src/Language.Haskell.TH.Lib.Internal.html#appE"><span class="hs-identifier hs-var">TH.appE</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; m Exp
forall (m :: * -&gt; *). Quote m =&gt; Name -&gt; m Exp
</span><a href="../../template-haskell/src/Language.Haskell.TH.Lib.Internal.html#varE"><span class="hs-identifier hs-var">TH.varE</span></a></span><span> </span><span class="hs-special">'</span><span class="hs-identifier">pack</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(m Exp -&gt; m Exp) -&gt; (Text -&gt; m Exp) -&gt; Text -&gt; m Exp
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; m Exp
forall (m :: * -&gt; *). Quote m =&gt; String -&gt; m Exp
</span><a href="../../template-haskell/src/Language.Haskell.TH.Lib.Internal.html#stringE"><span class="hs-identifier hs-var">TH.stringE</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; m Exp) -&gt; (Text -&gt; String) -&gt; Text -&gt; m Exp
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; String
</span><a href="Data.Text.Show.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span class="hs-cpp">
#if MIN_VERSION_template_haskell(2,17,0)
</span><span>  </span><span id="local-6989586621679110566"><span class="annot"><span class="annottext">liftTyped :: forall (m :: * -&gt; *). Quote m =&gt; Text -&gt; Code m Text
</span><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#liftTyped"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftTyped</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m Exp -&gt; Code m Text
forall a (m :: * -&gt; *). Quote m =&gt; m Exp -&gt; Code m a
</span><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#unsafeCodeCoerce"><span class="hs-identifier hs-var">TH.unsafeCodeCoerce</span></a></span><span> </span><span class="annot"><span class="annottext">(m Exp -&gt; Code m Text) -&gt; (Text -&gt; m Exp) -&gt; Text -&gt; Code m Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; m Exp
forall t (m :: * -&gt; *). (Lift t, Quote m) =&gt; t -&gt; m Exp
</span><a href="../../template-haskell/src/Language.Haskell.TH.Syntax.html#lift"><span class="hs-identifier hs-var">TH.lift</span></a></span><span class="hs-cpp">
#elif MIN_VERSION_template_haskell(2,16,0)
</span><span>  </span><span class="hs-identifier">liftTyped</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">TH.unsafeTExpCoerce</span><span> </span><span class="hs-operator">.</span><span> </span><span class="hs-identifier">TH.lift</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-415"></span><span class="hs-comment">-- | @since 1.2.2.0</span><span>
</span><span id="line-416"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679110563"><span class="annot"><a href="../../base/src/Text.Printf.html#PrintfArg"><span class="hs-identifier hs-type">PrintfArg</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-417"></span><span>  </span><span id="local-6989586621679110559"><span class="annot"><span class="annottext">formatArg :: Text -&gt; FieldFormatter
</span><a href="#local-6989586621679110559"><span class="hs-identifier hs-var hs-var hs-var hs-var">formatArg</span></a></span></span><span> </span><span id="local-6989586621679110558"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110558"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; FieldFormatter
forall a. IsChar a =&gt; [a] -&gt; FieldFormatter
</span><a href="../../base/src/Text.Printf.html#formatString"><span class="hs-identifier hs-var">formatString</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; FieldFormatter) -&gt; String -&gt; FieldFormatter
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; String
</span><a href="Data.Text.Show.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110558"><span class="hs-identifier hs-var">txt</span></a></span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="annot"><a href="Data.Text.html#packConstr"><span class="hs-identifier hs-type">packConstr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Constr"><span class="hs-identifier hs-type">Constr</span></a></span><span>
</span><span id="line-420"></span><span id="packConstr"><span class="annot"><span class="annottext">packConstr :: Constr
</span><a href="Data.Text.html#packConstr"><span class="hs-identifier hs-var hs-var">packConstr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataType -&gt; String -&gt; [String] -&gt; Fixity -&gt; Constr
</span><a href="../../base/src/Data.Data.html#mkConstr"><span class="hs-identifier hs-var">mkConstr</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="Data.Text.html#textDataType"><span class="hs-identifier hs-var">textDataType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;pack&quot;</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Fixity
</span><a href="../../base/src/Data.Data.html#Prefix"><span class="hs-identifier hs-var">Prefix</span></a></span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="annot"><a href="Data.Text.html#textDataType"><span class="hs-identifier hs-type">textDataType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#DataType"><span class="hs-identifier hs-type">DataType</span></a></span><span>
</span><span id="line-423"></span><span id="textDataType"><span class="annot"><span class="annottext">textDataType :: DataType
</span><a href="Data.Text.html#textDataType"><span class="hs-identifier hs-var hs-var">textDataType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Constr] -&gt; DataType
</span><a href="../../base/src/Data.Data.html#mkDataType"><span class="hs-identifier hs-var">mkDataType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.Text.Text&quot;</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Constr
</span><a href="Data.Text.html#packConstr"><span class="hs-identifier hs-var">packConstr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">-- | /O(n)/ Compare two 'Text' values lexicographically.</span><span>
</span><span id="line-426"></span><span class="annot"><a href="Data.Text.html#compareText"><span class="hs-identifier hs-type">compareText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Ordering"><span class="hs-identifier hs-type">Ordering</span></a></span><span>
</span><span id="line-427"></span><span id="compareText"><span class="annot"><span class="annottext">compareText :: Text -&gt; Text -&gt; Ordering
</span><a href="Data.Text.html#compareText"><span class="hs-identifier hs-var hs-var">compareText</span></a></span></span><span> </span><span id="local-6989586621679110557"><span class="annot"><span class="annottext">ta :: Text
</span><a href="#local-6989586621679110557"><span class="hs-identifier hs-var">ta</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110556"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110556"><span class="hs-identifier hs-var">_arrA</span></a></span></span><span> </span><span id="local-6989586621679110555"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110555"><span class="hs-identifier hs-var">_offA</span></a></span></span><span> </span><span id="local-6989586621679110554"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110554"><span class="hs-identifier hs-var">lenA</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679110553"><span class="annot"><span class="annottext">tb :: Text
</span><a href="#local-6989586621679110553"><span class="hs-identifier hs-var">tb</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110552"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110552"><span class="hs-identifier hs-var">_arrB</span></a></span></span><span> </span><span id="local-6989586621679110551"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110551"><span class="hs-identifier hs-var">_offB</span></a></span></span><span> </span><span id="local-6989586621679110550"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110550"><span class="hs-identifier hs-var">lenB</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-428"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110554"><span class="hs-identifier hs-var">lenA</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110550"><span class="hs-identifier hs-var">lenB</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-identifier hs-var">EQ</span></a></span><span>
</span><span id="line-429"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
</span><a href="#local-6989586621679110549"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-430"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-431"></span><span>    </span><span id="local-6989586621679110549"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; Ordering
</span><a href="#local-6989586621679110549"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110548"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110548"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110547"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110547"><span class="hs-identifier hs-var">j</span></a></span></span><span>
</span><span id="line-432"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110548"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110554"><span class="hs-identifier hs-var">lenA</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110547"><span class="hs-identifier hs-var">j</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110550"><span class="hs-identifier hs-var">lenB</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-identifier hs-var">compare</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110554"><span class="hs-identifier hs-var">lenA</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110550"><span class="hs-identifier hs-var">lenB</span></a></span><span>
</span><span id="line-433"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110546"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110544"><span class="hs-identifier hs-var">b</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-identifier hs-var">LT</span></a></span><span>
</span><span id="line-434"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110546"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110544"><span class="hs-identifier hs-var">b</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Ordering
</span><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-identifier hs-var">GT</span></a></span><span>
</span><span id="line-435"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Ordering
</span><a href="#local-6989586621679110549"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110548"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110542"><span class="hs-identifier hs-var">di</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110547"><span class="hs-identifier hs-var">j</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110541"><span class="hs-identifier hs-var">dj</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-436"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110546"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110546"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110542"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110542"><span class="hs-identifier hs-var">di</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110557"><span class="hs-identifier hs-var">ta</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110548"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-437"></span><span>            </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110544"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110544"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679110541"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110541"><span class="hs-identifier hs-var">dj</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110553"><span class="hs-identifier hs-var">tb</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110547"><span class="hs-identifier hs-var">j</span></a></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-440"></span><span class="hs-comment">-- * Conversion to/from 'Text'</span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span class="hs-comment">-- | /O(n)/ Convert a 'String' into a 'Text'.  Subject to</span><span>
</span><span id="line-443"></span><span class="hs-comment">-- fusion.  Performs replacement on invalid scalar values.</span><span>
</span><span id="line-444"></span><span class="annot"><a href="Data.Text.html#pack"><span class="hs-identifier hs-type">pack</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-445"></span><span id="pack"><span class="annot"><span class="annottext">pack :: String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var hs-var">pack</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Text) -&gt; (String -&gt; Stream Char) -&gt; String -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#map"><span class="hs-identifier hs-var">S.map</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Stream Char)
-&gt; (String -&gt; Stream Char) -&gt; String -&gt; Stream Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Stream Char
forall a. [a] -&gt; Stream a
</span><a href="Data.Text.Internal.Fusion.Common.html#streamList"><span class="hs-identifier hs-var">S.streamList</span></a></span><span>
</span><span id="line-446"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#pack"><span class="hs-pragma hs-type">pack</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-447"></span><span>
</span><span id="line-448"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-449"></span><span class="hs-comment">-- * Basic functions</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- | /O(n)/ Adds a character to the front of a 'Text'.  This function</span><span>
</span><span id="line-452"></span><span class="hs-comment">-- is more costly than its 'List' counterpart because it requires</span><span>
</span><span id="line-453"></span><span class="hs-comment">-- copying a new array.  Subject to fusion.  Performs replacement on</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- invalid scalar values.</span><span>
</span><span id="line-455"></span><span class="annot"><a href="Data.Text.html#cons"><span class="hs-identifier hs-type">cons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-456"></span><span id="cons"><span class="annot"><span class="annottext">cons :: Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#cons"><span class="hs-identifier hs-var hs-var">cons</span></a></span></span><span> </span><span id="local-6989586621679110537"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110537"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110536"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110536"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#cons"><span class="hs-identifier hs-var">S.cons</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110537"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110536"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-457"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#cons"><span class="hs-pragma hs-type">cons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">5</span><span> </span><span class="annot"><a href="Data.Text.html#cons"><span class="hs-operator hs-type">`cons`</span></a></span><span>
</span><span id="line-460"></span><span>
</span><span id="line-461"></span><span class="hs-comment">-- | /O(n)/ Adds a character to the end of a 'Text'.  This copies the</span><span>
</span><span id="line-462"></span><span class="hs-comment">-- entire array in the process, unless fused.  Subject to fusion.</span><span>
</span><span id="line-463"></span><span class="hs-comment">-- Performs replacement on invalid scalar values.</span><span>
</span><span id="line-464"></span><span class="annot"><a href="Data.Text.html#snoc"><span class="hs-identifier hs-type">snoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-465"></span><span id="snoc"><span class="annot"><span class="annottext">snoc :: Text -&gt; Char -&gt; Text
</span><a href="Data.Text.html#snoc"><span class="hs-identifier hs-var hs-var">snoc</span></a></span></span><span> </span><span id="local-6989586621679110534"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110534"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110533"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110533"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Stream Char -&gt; Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#snoc"><span class="hs-identifier hs-var">S.snoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110534"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110533"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#snoc"><span class="hs-pragma hs-type">snoc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-467"></span><span>
</span><span id="line-468"></span><span class="hs-comment">-- | /O(n)/ Appends one 'Text' to the other by copying both of them</span><span>
</span><span id="line-469"></span><span class="hs-comment">-- into a new 'Text'.  Subject to fusion.</span><span>
</span><span id="line-470"></span><span class="annot"><a href="Data.Text.html#append"><span class="hs-identifier hs-type">append</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-471"></span><span id="append"><span class="annot"><span class="annottext">append :: Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-identifier hs-var hs-var">append</span></a></span></span><span> </span><span id="local-6989586621679110531"><span class="annot"><span class="annottext">a :: Text
</span><a href="#local-6989586621679110531"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110530"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110530"><span class="hs-identifier hs-var">arr1</span></a></span></span><span> </span><span id="local-6989586621679110529"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110529"><span class="hs-identifier hs-var">off1</span></a></span></span><span> </span><span id="local-6989586621679110528"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110528"><span class="hs-identifier hs-var">len1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679110527"><span class="annot"><span class="annottext">b :: Text
</span><a href="#local-6989586621679110527"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110526"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110526"><span class="hs-identifier hs-var">arr2</span></a></span></span><span> </span><span id="local-6989586621679110525"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110525"><span class="hs-identifier hs-var">off2</span></a></span></span><span> </span><span id="local-6989586621679110524"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110524"><span class="hs-identifier hs-var">len2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-472"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110528"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110527"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-473"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110524"><span class="hs-identifier hs-var">len2</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110531"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-474"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110523"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s (MArray s)) -&gt; Array
</span><a href="Data.Text.Array.html#run"><span class="hs-identifier hs-var">A.run</span></a></span><span> </span><span class="annot"><span class="annottext">forall s. ST s (MArray s)
</span><a href="#local-6989586621679110521"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110523"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-475"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
forall a. String -&gt; a
</span><a href="Data.Text.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;append&quot;</span></span><span>
</span><span id="line-476"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-477"></span><span>      </span><span id="local-6989586621679110523"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110523"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110528"><span class="hs-identifier hs-var">len1</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110524"><span class="hs-identifier hs-var">len2</span></a></span><span>
</span><span id="line-478"></span><span>      </span><span id="local-6989586621679110519"><span class="annot"><a href="#local-6989586621679110521"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110519"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110519"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-479"></span><span>      </span><span id="local-6989586621679110521"><span class="annot"><span class="annottext">x :: forall s. ST s (MArray s)
</span><a href="#local-6989586621679110521"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-480"></span><span>        </span><span id="local-6989586621679110513"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110513"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110523"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-481"></span><span>        </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110513"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110530"><span class="hs-identifier hs-var">arr1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110529"><span class="hs-identifier hs-var">off1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110528"><span class="hs-identifier hs-var">len1</span></a></span><span>
</span><span id="line-482"></span><span>        </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110513"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110528"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110526"><span class="hs-identifier hs-var">arr2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110525"><span class="hs-identifier hs-var">off2</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110523"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-483"></span><span>        </span><span class="annot"><span class="annottext">MArray s -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110513"><span class="hs-identifier hs-var">arr</span></a></span><span>
</span><span id="line-484"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.Text.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-485"></span><span>
</span><span id="line-486"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-487"></span><span class="annot"><span class="hs-pragma">&quot;TEXT append -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110510"><span class="annot"><a href="#local-6989586621679110510"><span class="hs-pragma hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621679110509"><span class="annot"><a href="#local-6989586621679110509"><span class="hs-pragma hs-var">t2</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-488"></span><span>    </span><span class="annot"><a href="Data.Text.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110510"><span class="hs-pragma hs-type">t1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110509"><span class="hs-pragma hs-type">t2</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#append"><span class="hs-pragma hs-type">S.append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110510"><span class="hs-pragma hs-type">t1</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110509"><span class="hs-pragma hs-type">t2</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-489"></span><span class="annot"><span class="hs-pragma">&quot;TEXT append -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110507"><span class="annot"><a href="#local-6989586621679110507"><span class="hs-pragma hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621679110506"><span class="annot"><a href="#local-6989586621679110506"><span class="hs-pragma hs-var">t2</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-490"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#append"><span class="hs-pragma hs-type">S.append</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110507"><span class="hs-pragma hs-type">t1</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110506"><span class="hs-pragma hs-type">t2</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#append"><span class="hs-pragma hs-type">append</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110507"><span class="hs-pragma hs-type">t1</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110506"><span class="hs-pragma hs-type">t2</span></a></span><span>
</span><span id="line-491"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-492"></span><span>
</span><span id="line-493"></span><span class="hs-comment">-- | /O(1)/ Returns the first character of a 'Text', which must be</span><span>
</span><span id="line-494"></span><span class="hs-comment">-- non-empty.  Subject to fusion.</span><span>
</span><span id="line-495"></span><span class="annot"><a href="Data.Text.html#head"><span class="hs-identifier hs-type">head</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-496"></span><span id="head"><span class="annot"><span class="annottext">head :: Text -&gt; Char
</span><a href="Data.Text.html#head"><span class="hs-identifier hs-var hs-var">head</span></a></span></span><span> </span><span id="local-6989586621679110505"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110505"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#head"><span class="hs-identifier hs-var">S.head</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110505"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-497"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#head"><span class="hs-pragma hs-type">head</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span class="hs-comment">-- | /O(1)/ Returns the first character and rest of a 'Text', or</span><span>
</span><span id="line-500"></span><span class="hs-comment">-- 'Nothing' if empty. Subject to fusion.</span><span>
</span><span id="line-501"></span><span class="annot"><a href="Data.Text.html#uncons"><span class="hs-identifier hs-type">uncons</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-502"></span><span id="uncons"><span class="annot"><span class="annottext">uncons :: Text -&gt; Maybe (Char, Text)
</span><a href="Data.Text.html#uncons"><span class="hs-identifier hs-var hs-var">uncons</span></a></span></span><span> </span><span id="local-6989586621679110503"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110503"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110502"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110502"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110501"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110501"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110500"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110500"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110500"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Char, Text)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-504"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char, Text) -&gt; Maybe (Char, Text)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">((Char, Text) -&gt; Maybe (Char, Text))
-&gt; (Char, Text) -&gt; Maybe (Char, Text)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110498"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110498"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110497"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110497"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110503"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-505"></span><span>                         </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110498"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110502"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110501"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110497"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110500"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110497"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-506"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#uncons"><span class="hs-pragma hs-type">uncons</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-507"></span><span>
</span><span id="line-508"></span><span class="hs-comment">-- | Lifted from Control.Arrow and specialized.</span><span>
</span><span id="line-509"></span><span id="local-6989586621679111226"><span id="local-6989586621679111227"><span id="local-6989586621679111228"><span class="annot"><a href="Data.Text.html#second"><span class="hs-identifier hs-type">second</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111228"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111227"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111226"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679111228"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111226"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679111227"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-510"></span><span id="second"><span class="annot"><span class="annottext">second :: forall b c a. (b -&gt; c) -&gt; (a, b) -&gt; (a, c)
</span><a href="Data.Text.html#second"><span class="hs-identifier hs-var hs-var">second</span></a></span></span><span> </span><span id="local-6989586621679110495"><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679110495"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110494"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110494"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679110493"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679110493"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110494"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b -&gt; c
</span><a href="#local-6989586621679110495"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679110493"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span class="hs-comment">-- | /O(1)/ Returns the last character of a 'Text', which must be</span><span>
</span><span id="line-513"></span><span class="hs-comment">-- non-empty.  Subject to fusion.</span><span>
</span><span id="line-514"></span><span class="annot"><a href="Data.Text.html#last"><span class="hs-identifier hs-type">last</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-515"></span><span id="last"><span class="annot"><span class="annottext">last :: Text -&gt; Char
</span><a href="Data.Text.html#last"><span class="hs-identifier hs-var hs-var">last</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110492"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110492"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110491"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110491"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110490"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110490"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-516"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110490"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Char
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;last&quot;</span></span><span>
</span><span id="line-517"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110488"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDC00</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110488"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDFFF</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110488"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-518"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf16.html#chr2"><span class="hs-identifier hs-var">U16.chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110486"><span class="hs-identifier hs-var">n0</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110488"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-519"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110488"><span class="annot"><span class="annottext">n :: Word16
</span><a href="#local-6989586621679110488"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Word16
</span><a href="Data.Text.Array.html#unsafeIndex"><span class="hs-identifier hs-var">A.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110492"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110491"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110490"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-520"></span><span>          </span><span id="local-6989586621679110486"><span class="annot"><span class="annottext">n0 :: Word16
</span><a href="#local-6989586621679110486"><span class="hs-identifier hs-var hs-var">n0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Word16
</span><a href="Data.Text.Array.html#unsafeIndex"><span class="hs-identifier hs-var">A.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110492"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110491"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110490"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-521"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#last"><span class="hs-pragma hs-type">last</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-522"></span><span>
</span><span id="line-523"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-524"></span><span class="annot"><span class="hs-pragma">&quot;TEXT last -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110484"><span class="annot"><a href="#local-6989586621679110484"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-525"></span><span>    </span><span class="annot"><a href="Data.Text.html#last"><span class="hs-pragma hs-type">last</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110484"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#last"><span class="hs-pragma hs-type">S.last</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110484"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-526"></span><span class="annot"><span class="hs-pragma">&quot;TEXT last -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110482"><span class="annot"><a href="#local-6989586621679110482"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-527"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#last"><span class="hs-pragma hs-type">S.last</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110482"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#last"><span class="hs-pragma hs-type">last</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110482"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-528"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-529"></span><span>
</span><span id="line-530"></span><span class="hs-comment">-- | /O(1)/ Returns all characters after the head of a 'Text', which</span><span>
</span><span id="line-531"></span><span class="hs-comment">-- must be non-empty.  Subject to fusion.</span><span>
</span><span id="line-532"></span><span class="annot"><a href="Data.Text.html#tail"><span class="hs-identifier hs-type">tail</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-533"></span><span id="tail"><span class="annot"><span class="annottext">tail :: Text -&gt; Text
</span><a href="Data.Text.html#tail"><span class="hs-identifier hs-var hs-var">tail</span></a></span></span><span> </span><span id="local-6989586621679110481"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110481"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110480"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110480"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110479"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110479"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110478"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110478"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-534"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110478"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tail&quot;</span></span><span>
</span><span id="line-535"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110480"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110479"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110477"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110478"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110477"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110477"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679110477"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Int
</span><a href="Data.Text.Unsafe.html#iter_"><span class="hs-identifier hs-var">iter_</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110481"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-537"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-538"></span><span>
</span><span id="line-539"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-540"></span><span class="annot"><span class="hs-pragma">&quot;TEXT tail -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110476"><span class="annot"><a href="#local-6989586621679110476"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-541"></span><span>    </span><span class="annot"><a href="Data.Text.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110476"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#tail"><span class="hs-pragma hs-type">S.tail</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110476"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-542"></span><span class="annot"><span class="hs-pragma">&quot;TEXT tail -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110474"><span class="annot"><a href="#local-6989586621679110474"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-543"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#tail"><span class="hs-pragma hs-type">S.tail</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110474"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#tail"><span class="hs-pragma hs-type">tail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110474"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-544"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-545"></span><span>
</span><span id="line-546"></span><span class="hs-comment">-- | /O(1)/ Returns all but the last character of a 'Text', which must</span><span>
</span><span id="line-547"></span><span class="hs-comment">-- be non-empty.  Subject to fusion.</span><span>
</span><span id="line-548"></span><span class="annot"><a href="Data.Text.html#init"><span class="hs-identifier hs-type">init</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-549"></span><span id="init"><span class="annot"><span class="annottext">init :: Text -&gt; Text
</span><a href="Data.Text.html#init"><span class="hs-identifier hs-var hs-var">init</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110473"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110473"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110472"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110472"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110471"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110471"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110471"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;init&quot;</span></span><span>
</span><span id="line-550"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110470"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDC00</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110470"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDFFF</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110473"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110472"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110471"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-551"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110473"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110472"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110471"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-552"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-553"></span><span>      </span><span id="local-6989586621679110470"><span class="annot"><span class="annottext">n :: Word16
</span><a href="#local-6989586621679110470"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Word16
</span><a href="Data.Text.Array.html#unsafeIndex"><span class="hs-identifier hs-var">A.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110473"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110472"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110471"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-554"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#init"><span class="hs-pragma hs-type">init</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-555"></span><span>
</span><span id="line-556"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-557"></span><span class="annot"><span class="hs-pragma">&quot;TEXT init -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110469"><span class="annot"><a href="#local-6989586621679110469"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-558"></span><span>    </span><span class="annot"><a href="Data.Text.html#init"><span class="hs-pragma hs-type">init</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110469"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#init"><span class="hs-pragma hs-type">S.init</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110469"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-559"></span><span class="annot"><span class="hs-pragma">&quot;TEXT init -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110467"><span class="annot"><a href="#local-6989586621679110467"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-560"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#init"><span class="hs-pragma hs-type">S.init</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110467"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#init"><span class="hs-pragma hs-type">init</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110467"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-561"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-comment">-- | /O(1)/ Returns all but the last character and the last character of a</span><span>
</span><span id="line-564"></span><span class="hs-comment">-- 'Text', or 'Nothing' if empty.</span><span>
</span><span id="line-565"></span><span class="hs-comment">--</span><span>
</span><span id="line-566"></span><span class="hs-comment">-- @since 1.2.3.0</span><span>
</span><span id="line-567"></span><span class="annot"><a href="Data.Text.html#unsnoc"><span class="hs-identifier hs-type">unsnoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-568"></span><span id="unsnoc"><span class="annot"><span class="annottext">unsnoc :: Text -&gt; Maybe (Text, Char)
</span><a href="Data.Text.html#unsnoc"><span class="hs-identifier hs-var hs-var">unsnoc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110466"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110466"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110465"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110465"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110464"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-569"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Text, Char)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-570"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110463"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDC00</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110463"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><span class="hs-number">0xDFFF</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Text, Char) -&gt; Maybe (Text, Char)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110466"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110465"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Char
</span><a href="Data.Text.Internal.Unsafe.Char.html#unsafeChr"><span class="hs-identifier hs-var">unsafeChr</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110463"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-571"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Text, Char) -&gt; Maybe (Text, Char)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110466"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110465"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Word16 -&gt; Word16 -&gt; Char
</span><a href="Data.Text.Internal.Encoding.Utf16.html#chr2"><span class="hs-identifier hs-var">U16.chr2</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110462"><span class="hs-identifier hs-var">n0</span></a></span><span> </span><span class="annot"><span class="annottext">Word16
</span><a href="#local-6989586621679110463"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-572"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110463"><span class="annot"><span class="annottext">n :: Word16
</span><a href="#local-6989586621679110463"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Word16
</span><a href="Data.Text.Array.html#unsafeIndex"><span class="hs-identifier hs-var">A.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110466"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110465"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span>          </span><span id="local-6989586621679110462"><span class="annot"><span class="annottext">n0 :: Word16
</span><a href="#local-6989586621679110462"><span class="hs-identifier hs-var hs-var">n0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Word16
</span><a href="Data.Text.Array.html#unsafeIndex"><span class="hs-identifier hs-var">A.unsafeIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110466"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110465"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110464"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#unsnoc"><span class="hs-pragma hs-type">unsnoc</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-575"></span><span>
</span><span id="line-576"></span><span class="hs-comment">-- | /O(1)/ Tests whether a 'Text' is empty or not.  Subject to</span><span>
</span><span id="line-577"></span><span class="hs-comment">-- fusion.</span><span>
</span><span id="line-578"></span><span class="annot"><a href="Data.Text.html#null"><span class="hs-identifier hs-type">null</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-579"></span><span id="null"><span class="annot"><span class="annottext">null :: Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var hs-var">null</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110461"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110461"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679110460"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110460"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679110459"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110459"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>    </span><span class="hs-identifier">assert</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">len</span><span> </span><span class="hs-operator">&gt;=</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span class="hs-cpp">
#endif
</span><span>    </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110459"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-584"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-587"></span><span class="annot"><span class="hs-pragma">&quot;TEXT null -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110458"><span class="annot"><a href="#local-6989586621679110458"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-588"></span><span>    </span><span class="annot"><a href="Data.Text.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110458"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#null"><span class="hs-pragma hs-type">S.null</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110458"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-589"></span><span class="annot"><span class="hs-pragma">&quot;TEXT null -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110456"><span class="annot"><a href="#local-6989586621679110456"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-590"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#null"><span class="hs-pragma hs-type">S.null</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110456"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#null"><span class="hs-pragma hs-type">null</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110456"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-591"></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-592"></span><span>
</span><span id="line-593"></span><span class="hs-comment">-- | /O(1)/ Tests whether a 'Text' contains exactly one character.</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- Subject to fusion.</span><span>
</span><span id="line-595"></span><span class="annot"><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-type">isSingleton</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-596"></span><span id="isSingleton"><span class="annot"><span class="annottext">isSingleton :: Text -&gt; Bool
</span><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-var hs-var">isSingleton</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#isSingleton"><span class="hs-identifier hs-var">S.isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Bool) -&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span>
</span><span id="line-597"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#isSingleton"><span class="hs-pragma hs-type">isSingleton</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-598"></span><span>
</span><span id="line-599"></span><span class="hs-comment">-- | /O(n)/ Returns the number of characters in a 'Text'.</span><span>
</span><span id="line-600"></span><span class="hs-comment">-- Subject to fusion.</span><span>
</span><span id="line-601"></span><span class="annot"><a href="Data.Text.html#length"><span class="hs-identifier hs-type">length</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-606"></span><span id="length"><span class="annot"><span class="annottext">length :: Text -&gt; Int
</span><a href="Data.Text.html#length"><span class="hs-identifier hs-var hs-var">length</span></a></span></span><span> </span><span id="local-6989586621679110453"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110453"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Int
</span><a href="Data.Text.Internal.Fusion.html#length"><span class="hs-identifier hs-var">S.length</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110453"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-607"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-608"></span><span class="hs-comment">-- length needs to be phased after the compareN/length rules otherwise</span><span>
</span><span id="line-609"></span><span class="hs-comment">-- it may inline before the rules have an opportunity to fire.</span><span>
</span><span id="line-610"></span><span>
</span><span id="line-611"></span><span class="hs-comment">-- | /O(n)/ Compare the count of characters in a 'Text' to a number.</span><span>
</span><span id="line-612"></span><span class="hs-comment">-- Subject to fusion.</span><span>
</span><span id="line-613"></span><span class="hs-comment">--</span><span>
</span><span id="line-614"></span><span class="hs-comment">-- This function gives the same answer as comparing against the result</span><span>
</span><span id="line-615"></span><span class="hs-comment">-- of 'length', but can short circuit if the count of characters is</span><span>
</span><span id="line-616"></span><span class="hs-comment">-- greater than the number, and hence be more efficient.</span><span>
</span><span id="line-617"></span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-identifier hs-type">compareLength</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Ordering"><span class="hs-identifier hs-type">Ordering</span></a></span><span>
</span><span id="line-618"></span><span id="compareLength"><span class="annot"><span class="annottext">compareLength :: Text -&gt; Int -&gt; Ordering
</span><a href="Data.Text.html#compareLength"><span class="hs-identifier hs-var hs-var">compareLength</span></a></span></span><span> </span><span id="local-6989586621679110451"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110451"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110450"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110450"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Int -&gt; Ordering
forall a. Integral a =&gt; Stream Char -&gt; a -&gt; Ordering
</span><a href="Data.Text.Internal.Fusion.Common.html#compareLengthI"><span class="hs-identifier hs-var">S.compareLengthI</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110451"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110450"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-619"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-620"></span><span>
</span><span id="line-621"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-622"></span><span class="annot"><span class="hs-pragma">&quot;TEXT compareN/length -&gt; compareLength&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110448"><span class="annot"><a href="#local-6989586621679110448"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110447"><span class="annot"><a href="#local-6989586621679110447"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-623"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-pragma hs-type">compare</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110448"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110447"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110448"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110447"><span class="hs-pragma hs-type">n</span></a></span><span>
</span><span id="line-624"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-625"></span><span>
</span><span id="line-626"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-627"></span><span class="annot"><span class="hs-pragma">&quot;TEXT ==N/length -&gt; compareLength/==EQ&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110446"><span class="annot"><a href="#local-6989586621679110446"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110445"><span class="annot"><a href="#local-6989586621679110445"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-628"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#eqInt"><span class="hs-pragma hs-type">eqInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110446"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110445"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110446"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110445"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-pragma hs-type">==</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-pragma hs-type">EQ</span></a></span><span>
</span><span id="line-629"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-632"></span><span class="annot"><span class="hs-pragma">&quot;TEXT /=N/length -&gt; compareLength//=EQ&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110444"><span class="annot"><a href="#local-6989586621679110444"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110443"><span class="annot"><a href="#local-6989586621679110443"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-633"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#neInt"><span class="hs-pragma hs-type">neInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110444"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110443"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110444"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110443"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-pragma hs-type">/=</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#EQ"><span class="hs-pragma hs-type">EQ</span></a></span><span>
</span><span id="line-634"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-635"></span><span>
</span><span id="line-636"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-637"></span><span class="annot"><span class="hs-pragma">&quot;TEXT &lt;N/length -&gt; compareLength/==LT&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110441"><span class="annot"><a href="#local-6989586621679110441"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110440"><span class="annot"><a href="#local-6989586621679110440"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-638"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#ltInt"><span class="hs-pragma hs-type">ltInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110441"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110440"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110441"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110440"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-pragma hs-type">==</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-pragma hs-type">LT</span></a></span><span>
</span><span id="line-639"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-640"></span><span>
</span><span id="line-641"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-642"></span><span class="annot"><span class="hs-pragma">&quot;TEXT &lt;=N/length -&gt; compareLength//=GT&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110439"><span class="annot"><a href="#local-6989586621679110439"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110438"><span class="annot"><a href="#local-6989586621679110438"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-643"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#leInt"><span class="hs-pragma hs-type">leInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110439"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110438"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110439"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110438"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-pragma hs-type">/=</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-pragma hs-type">GT</span></a></span><span>
</span><span id="line-644"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-645"></span><span>
</span><span id="line-646"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-647"></span><span class="annot"><span class="hs-pragma">&quot;TEXT &gt;N/length -&gt; compareLength/==GT&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110437"><span class="annot"><a href="#local-6989586621679110437"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110436"><span class="annot"><a href="#local-6989586621679110436"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-648"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#gtInt"><span class="hs-pragma hs-type">gtInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110437"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110436"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110437"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110436"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-pragma hs-type">==</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#GT"><span class="hs-pragma hs-type">GT</span></a></span><span>
</span><span id="line-649"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-650"></span><span>
</span><span id="line-651"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-652"></span><span class="annot"><span class="hs-pragma">&quot;TEXT &gt;=N/length -&gt; compareLength//=LT&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110435"><span class="annot"><a href="#local-6989586621679110435"><span class="hs-pragma hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110434"><span class="annot"><a href="#local-6989586621679110434"><span class="hs-pragma hs-var">n</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-653"></span><span>    </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#geInt"><span class="hs-pragma hs-type">geInt</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#length"><span class="hs-pragma hs-type">length</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110435"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110434"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#compareLength"><span class="hs-pragma hs-type">compareLength</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110435"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110434"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-pragma hs-type">/=</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#LT"><span class="hs-pragma hs-type">LT</span></a></span><span>
</span><span id="line-654"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-655"></span><span>
</span><span id="line-656"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-657"></span><span class="hs-comment">-- * Transformations</span><span>
</span><span id="line-658"></span><span class="hs-comment">-- | /O(n)/ 'map' @f@ @t@ is the 'Text' obtained by applying @f@ to</span><span>
</span><span id="line-659"></span><span class="hs-comment">-- each element of @t@.</span><span>
</span><span id="line-660"></span><span class="hs-comment">--</span><span>
</span><span id="line-661"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-662"></span><span class="hs-comment">--</span><span>
</span><span id="line-663"></span><span class="hs-comment">-- &gt;&gt;&gt; let message = pack &quot;I am not angry. Not at all.&quot;</span><span>
</span><span id="line-664"></span><span class="hs-comment">-- &gt;&gt;&gt; T.map (\c -&gt; if c == '.' then '!' else c) message</span><span>
</span><span id="line-665"></span><span class="hs-comment">-- &quot;I am not angry! Not at all!&quot;</span><span>
</span><span id="line-666"></span><span class="hs-comment">--</span><span>
</span><span id="line-667"></span><span class="hs-comment">-- Subject to fusion.  Performs replacement on invalid scalar values.</span><span>
</span><span id="line-668"></span><span class="annot"><a href="Data.Text.html#map"><span class="hs-identifier hs-type">map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-669"></span><span id="map"><span class="annot"><span class="annottext">map :: (Char -&gt; Char) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#map"><span class="hs-identifier hs-var hs-var">map</span></a></span></span><span> </span><span id="local-6989586621679110433"><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="#local-6989586621679110433"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110432"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110432"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#map"><span class="hs-identifier hs-var">S.map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; (Char -&gt; Char) -&gt; Char -&gt; Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="#local-6989586621679110433"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110432"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-670"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#map"><span class="hs-pragma hs-type">map</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-671"></span><span>
</span><span id="line-672"></span><span class="hs-comment">-- | /O(n)/ The 'intercalate' function takes a 'Text' and a list of</span><span>
</span><span id="line-673"></span><span class="hs-comment">-- 'Text's and concatenates the list after interspersing the first</span><span>
</span><span id="line-674"></span><span class="hs-comment">-- argument between each element of the list.</span><span>
</span><span id="line-675"></span><span class="hs-comment">--</span><span>
</span><span id="line-676"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-677"></span><span class="hs-comment">--</span><span>
</span><span id="line-678"></span><span class="hs-comment">-- &gt;&gt;&gt; T.intercalate &quot;NI!&quot; [&quot;We&quot;, &quot;seek&quot;, &quot;the&quot;, &quot;Holy&quot;, &quot;Grail&quot;]</span><span>
</span><span id="line-679"></span><span class="hs-comment">-- &quot;WeNI!seekNI!theNI!HolyNI!Grail&quot;</span><span>
</span><span id="line-680"></span><span class="annot"><a href="Data.Text.html#intercalate"><span class="hs-identifier hs-type">intercalate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-681"></span><span id="intercalate"><span class="annot"><span class="annottext">intercalate :: Text -&gt; [Text] -&gt; Text
</span><a href="Data.Text.html#intercalate"><span class="hs-identifier hs-var hs-var">intercalate</span></a></span></span><span> </span><span id="local-6989586621679110431"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110431"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Text
</span><a href="Data.Text.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; Text) -&gt; ([Text] -&gt; [Text]) -&gt; [Text] -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="Data.Text.Internal.Functions.html#intersperse"><span class="hs-identifier hs-var">F.intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110431"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-682"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#intercalate"><span class="hs-pragma hs-type">intercalate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-683"></span><span>
</span><span id="line-684"></span><span class="hs-comment">-- | /O(n)/ The 'intersperse' function takes a character and places it</span><span>
</span><span id="line-685"></span><span class="hs-comment">-- between the characters of a 'Text'.</span><span>
</span><span id="line-686"></span><span class="hs-comment">--</span><span>
</span><span id="line-687"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-688"></span><span class="hs-comment">--</span><span>
</span><span id="line-689"></span><span class="hs-comment">-- &gt;&gt;&gt; T.intersperse '.' &quot;SHIELD&quot;</span><span>
</span><span id="line-690"></span><span class="hs-comment">-- &quot;S.H.I.E.L.D&quot;</span><span>
</span><span id="line-691"></span><span class="hs-comment">--</span><span>
</span><span id="line-692"></span><span class="hs-comment">-- Subject to fusion.  Performs replacement on invalid scalar values.</span><span>
</span><span id="line-693"></span><span class="annot"><a href="Data.Text.html#intersperse"><span class="hs-identifier hs-type">intersperse</span></a></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-694"></span><span id="intersperse"><span class="annot"><span class="annottext">intersperse :: Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#intersperse"><span class="hs-identifier hs-var hs-var">intersperse</span></a></span></span><span> </span><span id="local-6989586621679110429"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110429"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110428"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110428"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#intersperse"><span class="hs-identifier hs-var">S.intersperse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110429"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110428"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-695"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#intersperse"><span class="hs-pragma hs-type">intersperse</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span class="hs-comment">-- | /O(n)/ Reverse the characters of a string.</span><span>
</span><span id="line-698"></span><span class="hs-comment">--</span><span>
</span><span id="line-699"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-700"></span><span class="hs-comment">--</span><span>
</span><span id="line-701"></span><span class="hs-comment">-- &gt;&gt;&gt; T.reverse &quot;desrever&quot;</span><span>
</span><span id="line-702"></span><span class="hs-comment">-- &quot;reversed&quot;</span><span>
</span><span id="line-703"></span><span class="hs-comment">--</span><span>
</span><span id="line-704"></span><span class="hs-comment">-- Subject to fusion (fuses with its argument).</span><span>
</span><span id="line-705"></span><span class="annot"><a href="Data.Text.html#reverse"><span class="hs-identifier hs-type">reverse</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-710"></span><span id="reverse"><span class="annot"><span class="annottext">reverse :: Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var hs-var">reverse</span></a></span></span><span> </span><span id="local-6989586621679110426"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110426"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#reverse"><span class="hs-identifier hs-var">S.reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110426"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-711"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#reverse"><span class="hs-pragma hs-type">reverse</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-712"></span><span>
</span><span id="line-713"></span><span class="hs-comment">-- | /O(m+n)/ Replace every non-overlapping occurrence of @needle@ in</span><span>
</span><span id="line-714"></span><span class="hs-comment">-- @haystack@ with @replacement@.</span><span>
</span><span id="line-715"></span><span class="hs-comment">--</span><span>
</span><span id="line-716"></span><span class="hs-comment">-- This function behaves as though it was defined as follows:</span><span>
</span><span id="line-717"></span><span class="hs-comment">--</span><span>
</span><span id="line-718"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-719"></span><span class="hs-comment">-- replace needle replacement haystack =</span><span>
</span><span id="line-720"></span><span class="hs-comment">--   'intercalate' replacement ('splitOn' needle haystack)</span><span>
</span><span id="line-721"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-722"></span><span class="hs-comment">--</span><span>
</span><span id="line-723"></span><span class="hs-comment">-- As this suggests, each occurrence is replaced exactly once.  So if</span><span>
</span><span id="line-724"></span><span class="hs-comment">-- @needle@ occurs in @replacement@, that occurrence will /not/ itself</span><span>
</span><span id="line-725"></span><span class="hs-comment">-- be replaced recursively:</span><span>
</span><span id="line-726"></span><span class="hs-comment">--</span><span>
</span><span id="line-727"></span><span class="hs-comment">-- &gt;&gt;&gt; replace &quot;oo&quot; &quot;foo&quot; &quot;oo&quot;</span><span>
</span><span id="line-728"></span><span class="hs-comment">-- &quot;foo&quot;</span><span>
</span><span id="line-729"></span><span class="hs-comment">--</span><span>
</span><span id="line-730"></span><span class="hs-comment">-- In cases where several instances of @needle@ overlap, only the</span><span>
</span><span id="line-731"></span><span class="hs-comment">-- first one will be replaced:</span><span>
</span><span id="line-732"></span><span class="hs-comment">--</span><span>
</span><span id="line-733"></span><span class="hs-comment">-- &gt;&gt;&gt; replace &quot;ofo&quot; &quot;bar&quot; &quot;ofofo&quot;</span><span>
</span><span id="line-734"></span><span class="hs-comment">-- &quot;barfo&quot;</span><span>
</span><span id="line-735"></span><span class="hs-comment">--</span><span>
</span><span id="line-736"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-737"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-738"></span><span class="annot"><a href="Data.Text.html#replace"><span class="hs-identifier hs-type">replace</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-739"></span><span>        </span><span class="hs-comment">-- ^ @needle@ to search for.  If this string is empty, an</span><span>
</span><span id="line-740"></span><span>        </span><span class="hs-comment">-- error will occur.</span><span>
</span><span id="line-741"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-742"></span><span>        </span><span class="hs-comment">-- ^ @replacement@ to replace @needle@ with.</span><span>
</span><span id="line-743"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-744"></span><span>        </span><span class="hs-comment">-- ^ @haystack@ in which to search.</span><span>
</span><span id="line-745"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-746"></span><span id="replace"><span class="annot"><span class="annottext">replace :: Text -&gt; Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#replace"><span class="hs-identifier hs-var hs-var">replace</span></a></span></span><span> </span><span id="local-6989586621679110424"><span class="annot"><span class="annottext">needle :: Text
</span><a href="#local-6989586621679110424"><span class="hs-identifier hs-var">needle</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span>      </span><span id="local-6989586621679110423"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110423"><span class="hs-identifier hs-var">neeLen</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-747"></span><span>               </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110422"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110422"><span class="hs-identifier hs-var">repArr</span></a></span></span><span> </span><span id="local-6989586621679110421"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110421"><span class="hs-identifier hs-var">repOff</span></a></span></span><span> </span><span id="local-6989586621679110420"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110420"><span class="hs-identifier hs-var">repLen</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-748"></span><span>      </span><span id="local-6989586621679110419"><span class="annot"><span class="annottext">haystack :: Text
</span><a href="#local-6989586621679110419"><span class="hs-identifier hs-var">haystack</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110418"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110418"><span class="hs-identifier hs-var">hayArr</span></a></span></span><span> </span><span id="local-6989586621679110417"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110417"><span class="hs-identifier hs-var">hayOff</span></a></span></span><span> </span><span id="local-6989586621679110416"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110416"><span class="hs-identifier hs-var">hayLen</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-749"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110423"><span class="hs-identifier hs-var">neeLen</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;replace&quot;</span></span><span>
</span><span id="line-750"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">L.null</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110414"><span class="hs-identifier hs-var">ixs</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110419"><span class="hs-identifier hs-var">haystack</span></a></span><span>
</span><span id="line-751"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110413"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s (MArray s)) -&gt; Array
</span><a href="Data.Text.Array.html#run"><span class="hs-identifier hs-var">A.run</span></a></span><span> </span><span class="annot"><span class="annottext">forall s. ST s (MArray s)
</span><a href="#local-6989586621679110412"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110413"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-752"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-753"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-754"></span><span>    </span><span id="local-6989586621679110414"><span class="annot"><span class="annottext">ixs :: [Int]
</span><a href="#local-6989586621679110414"><span class="hs-identifier hs-var hs-var">ixs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110424"><span class="hs-identifier hs-var">needle</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110419"><span class="hs-identifier hs-var">haystack</span></a></span><span>
</span><span id="line-755"></span><span>    </span><span id="local-6989586621679110413"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110413"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110416"><span class="hs-identifier hs-var">hayLen</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110423"><span class="hs-identifier hs-var">neeLen</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110420"><span class="hs-identifier hs-var">repLen</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="Data.Text.Internal.html#mul"><span class="hs-operator hs-var">`mul`</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">L.length</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110414"><span class="hs-identifier hs-var">ixs</span></a></span><span>
</span><span id="line-756"></span><span>    </span><span id="local-6989586621679110410"><span class="annot"><a href="#local-6989586621679110412"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110410"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110410"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-757"></span><span>    </span><span id="local-6989586621679110412"><span class="annot"><span class="annottext">x :: forall s. ST s (MArray s)
</span><a href="#local-6989586621679110412"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-758"></span><span>      </span><span id="local-6989586621679110396"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110396"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110413"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-759"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110395"><span class="annot"><span class="annottext">loop :: [Int] -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="#local-6989586621679110395"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110394"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110394"><span class="hs-identifier hs-var">i</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679110393"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110393"><span class="hs-identifier hs-var">is</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679110392"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110392"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679110391"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110391"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-760"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110390"><span class="annot"><span class="annottext">d0 :: Int
</span><a href="#local-6989586621679110390"><span class="hs-identifier hs-var hs-var">d0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110391"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110394"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110392"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-761"></span><span>                </span><span id="local-6989586621679110389"><span class="annot"><span class="annottext">d1 :: Int
</span><a href="#local-6989586621679110389"><span class="hs-identifier hs-var hs-var">d1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110390"><span class="hs-identifier hs-var">d0</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110420"><span class="hs-identifier hs-var">repLen</span></a></span><span>
</span><span id="line-762"></span><span>            </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110396"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110391"><span class="hs-identifier hs-var">d</span></a></span><span>  </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110418"><span class="hs-identifier hs-var">hayArr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110417"><span class="hs-identifier hs-var">hayOff</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110392"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110390"><span class="hs-identifier hs-var">d0</span></a></span><span>
</span><span id="line-763"></span><span>            </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110396"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110390"><span class="hs-identifier hs-var">d0</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110422"><span class="hs-identifier hs-var">repArr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110421"><span class="hs-identifier hs-var">repOff</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110389"><span class="hs-identifier hs-var">d1</span></a></span><span>
</span><span id="line-764"></span><span>            </span><span class="annot"><span class="annottext">[Int] -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="#local-6989586621679110395"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110393"><span class="hs-identifier hs-var">is</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110394"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110423"><span class="hs-identifier hs-var">neeLen</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110389"><span class="hs-identifier hs-var">d1</span></a></span><span>
</span><span id="line-765"></span><span>          </span><span class="annot"><a href="#local-6989586621679110395"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span id="local-6989586621679110388"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110388"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679110387"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110387"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110396"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110387"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110418"><span class="hs-identifier hs-var">hayArr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110417"><span class="hs-identifier hs-var">hayOff</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110388"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110413"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-766"></span><span>      </span><span class="annot"><span class="annottext">[Int] -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="#local-6989586621679110395"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110414"><span class="hs-identifier hs-var">ixs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-767"></span><span>      </span><span class="annot"><span class="annottext">MArray s -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110396"><span class="hs-identifier hs-var">marr</span></a></span><span>
</span><span id="line-768"></span><span>
</span><span id="line-769"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-770"></span><span class="hs-comment">-- ** Case conversions (folds)</span><span>
</span><span id="line-771"></span><span>
</span><span id="line-772"></span><span class="hs-comment">-- $case</span><span>
</span><span id="line-773"></span><span class="hs-comment">--</span><span>
</span><span id="line-774"></span><span class="hs-comment">-- When case converting 'Text' values, do not use combinators like</span><span>
</span><span id="line-775"></span><span class="hs-comment">-- @map toUpper@ to case convert each character of a string</span><span>
</span><span id="line-776"></span><span class="hs-comment">-- individually, as this gives incorrect results according to the</span><span>
</span><span id="line-777"></span><span class="hs-comment">-- rules of some writing systems.  The whole-string case conversion</span><span>
</span><span id="line-778"></span><span class="hs-comment">-- functions from this module, such as @toUpper@, obey the correct</span><span>
</span><span id="line-779"></span><span class="hs-comment">-- case conversion rules.  As a result, these functions may map one</span><span>
</span><span id="line-780"></span><span class="hs-comment">-- input character to two or three output characters. For examples,</span><span>
</span><span id="line-781"></span><span class="hs-comment">-- see the documentation of each function.</span><span>
</span><span id="line-782"></span><span class="hs-comment">--</span><span>
</span><span id="line-783"></span><span class="hs-comment">-- /Note/: In some languages, case conversion is a locale- and</span><span>
</span><span id="line-784"></span><span class="hs-comment">-- context-dependent operation. The case conversion functions in this</span><span>
</span><span id="line-785"></span><span class="hs-comment">-- module are /not/ locale sensitive. Programs that require locale</span><span>
</span><span id="line-786"></span><span class="hs-comment">-- sensitivity should use appropriate versions of the</span><span>
</span><span id="line-787"></span><span class="hs-comment">-- &lt;http://hackage.haskell.org/package/text-icu-0.6.3.7/docs/Data-Text-ICU.html#g:4 case mapping functions from the text-icu package &gt;.</span><span>
</span><span id="line-788"></span><span>
</span><span id="line-789"></span><span class="hs-comment">-- | /O(n)/ Convert a string to folded case.  Subject to fusion.</span><span>
</span><span id="line-790"></span><span class="hs-comment">--</span><span>
</span><span id="line-791"></span><span class="hs-comment">-- This function is mainly useful for performing caseless (also known</span><span>
</span><span id="line-792"></span><span class="hs-comment">-- as case insensitive) string comparisons.</span><span>
</span><span id="line-793"></span><span class="hs-comment">--</span><span>
</span><span id="line-794"></span><span class="hs-comment">-- A string @x@ is a caseless match for a string @y@ if and only if:</span><span>
</span><span id="line-795"></span><span class="hs-comment">--</span><span>
</span><span id="line-796"></span><span class="hs-comment">-- @toCaseFold x == toCaseFold y@</span><span>
</span><span id="line-797"></span><span class="hs-comment">--</span><span>
</span><span id="line-798"></span><span class="hs-comment">-- The result string may be longer than the input string, and may</span><span>
</span><span id="line-799"></span><span class="hs-comment">-- differ from applying 'toLower' to the input string.  For instance,</span><span>
</span><span id="line-800"></span><span class="hs-comment">-- the Armenian small ligature \&quot;&amp;#xfb13;\&quot; (men now, U+FB13) is case</span><span>
</span><span id="line-801"></span><span class="hs-comment">-- folded to the sequence \&quot;&amp;#x574;\&quot; (men, U+0574) followed by</span><span>
</span><span id="line-802"></span><span class="hs-comment">-- \&quot;&amp;#x576;\&quot; (now, U+0576), while the Greek \&quot;&amp;#xb5;\&quot; (micro sign,</span><span>
</span><span id="line-803"></span><span class="hs-comment">-- U+00B5) is case folded to \&quot;&amp;#x3bc;\&quot; (small letter mu, U+03BC)</span><span>
</span><span id="line-804"></span><span class="hs-comment">-- instead of itself.</span><span>
</span><span id="line-805"></span><span class="annot"><a href="Data.Text.html#toCaseFold"><span class="hs-identifier hs-type">toCaseFold</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-806"></span><span id="toCaseFold"><span class="annot"><span class="annottext">toCaseFold :: Text -&gt; Text
</span><a href="Data.Text.html#toCaseFold"><span class="hs-identifier hs-var hs-var">toCaseFold</span></a></span></span><span> </span><span id="local-6989586621679110386"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110386"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#toCaseFold"><span class="hs-identifier hs-var">S.toCaseFold</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110386"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-807"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#toCaseFold"><span class="hs-pragma hs-type">toCaseFold</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-808"></span><span>
</span><span id="line-809"></span><span class="hs-comment">-- | /O(n)/ Convert a string to lower case, using simple case</span><span>
</span><span id="line-810"></span><span class="hs-comment">-- conversion.  Subject to fusion.</span><span>
</span><span id="line-811"></span><span class="hs-comment">--</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- The result string may be longer than the input string.  For</span><span>
</span><span id="line-813"></span><span class="hs-comment">-- instance, \&quot;&amp;#x130;\&quot; (Latin capital letter I with dot above,</span><span>
</span><span id="line-814"></span><span class="hs-comment">-- U+0130) maps to the sequence \&quot;i\&quot; (Latin small letter i, U+0069)</span><span>
</span><span id="line-815"></span><span class="hs-comment">-- followed by \&quot; &amp;#x307;\&quot; (combining dot above, U+0307).</span><span>
</span><span id="line-816"></span><span class="annot"><a href="Data.Text.html#toLower"><span class="hs-identifier hs-type">toLower</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-817"></span><span id="toLower"><span class="annot"><span class="annottext">toLower :: Text -&gt; Text
</span><a href="Data.Text.html#toLower"><span class="hs-identifier hs-var hs-var">toLower</span></a></span></span><span> </span><span id="local-6989586621679110384"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110384"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#toLower"><span class="hs-identifier hs-var">S.toLower</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110384"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-818"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#toLower"><span class="hs-pragma hs-type">toLower</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span class="hs-comment">-- | /O(n)/ Convert a string to upper case, using simple case</span><span>
</span><span id="line-821"></span><span class="hs-comment">-- conversion.  Subject to fusion.</span><span>
</span><span id="line-822"></span><span class="hs-comment">--</span><span>
</span><span id="line-823"></span><span class="hs-comment">-- The result string may be longer than the input string.  For</span><span>
</span><span id="line-824"></span><span class="hs-comment">-- instance, the German \&quot;&amp;#xdf;\&quot; (eszett, U+00DF) maps to the</span><span>
</span><span id="line-825"></span><span class="hs-comment">-- two-letter sequence \&quot;SS\&quot;.</span><span>
</span><span id="line-826"></span><span class="annot"><a href="Data.Text.html#toUpper"><span class="hs-identifier hs-type">toUpper</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-827"></span><span id="toUpper"><span class="annot"><span class="annottext">toUpper :: Text -&gt; Text
</span><a href="Data.Text.html#toUpper"><span class="hs-identifier hs-var hs-var">toUpper</span></a></span></span><span> </span><span id="local-6989586621679110382"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110382"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#toUpper"><span class="hs-identifier hs-var">S.toUpper</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110382"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-828"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#toUpper"><span class="hs-pragma hs-type">toUpper</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-829"></span><span>
</span><span id="line-830"></span><span class="hs-comment">-- | /O(n)/ Convert a string to title case, using simple case</span><span>
</span><span id="line-831"></span><span class="hs-comment">-- conversion. Subject to fusion.</span><span>
</span><span id="line-832"></span><span class="hs-comment">--</span><span>
</span><span id="line-833"></span><span class="hs-comment">-- The first letter of the input is converted to title case, as is</span><span>
</span><span id="line-834"></span><span class="hs-comment">-- every subsequent letter that immediately follows a non-letter.</span><span>
</span><span id="line-835"></span><span class="hs-comment">-- Every letter that immediately follows another letter is converted</span><span>
</span><span id="line-836"></span><span class="hs-comment">-- to lower case.</span><span>
</span><span id="line-837"></span><span class="hs-comment">--</span><span>
</span><span id="line-838"></span><span class="hs-comment">-- The result string may be longer than the input string. For example,</span><span>
</span><span id="line-839"></span><span class="hs-comment">-- the Latin small ligature &amp;#xfb02; (U+FB02) is converted to the</span><span>
</span><span id="line-840"></span><span class="hs-comment">-- sequence Latin capital letter F (U+0046) followed by Latin small</span><span>
</span><span id="line-841"></span><span class="hs-comment">-- letter l (U+006C).</span><span>
</span><span id="line-842"></span><span class="hs-comment">--</span><span>
</span><span id="line-843"></span><span class="hs-comment">-- /Note/: this function does not take language or culture specific</span><span>
</span><span id="line-844"></span><span class="hs-comment">-- rules into account. For instance, in English, different style</span><span>
</span><span id="line-845"></span><span class="hs-comment">-- guides disagree on whether the book name \&quot;The Hill of the Red</span><span>
</span><span id="line-846"></span><span class="hs-comment">-- Fox\&quot; is correctly title cased&amp;#x2014;but this function will</span><span>
</span><span id="line-847"></span><span class="hs-comment">-- capitalize /every/ word.</span><span>
</span><span id="line-848"></span><span class="hs-comment">--</span><span>
</span><span id="line-849"></span><span class="hs-comment">-- @since 1.0.0.0</span><span>
</span><span id="line-850"></span><span class="annot"><a href="Data.Text.html#toTitle"><span class="hs-identifier hs-type">toTitle</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-851"></span><span id="toTitle"><span class="annot"><span class="annottext">toTitle :: Text -&gt; Text
</span><a href="Data.Text.html#toTitle"><span class="hs-identifier hs-var hs-var">toTitle</span></a></span></span><span> </span><span id="local-6989586621679110380"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110380"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#toTitle"><span class="hs-identifier hs-var">S.toTitle</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110380"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-852"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#toTitle"><span class="hs-pragma hs-type">toTitle</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-853"></span><span>
</span><span id="line-854"></span><span class="hs-comment">-- | /O(n)/ Left-justify a string to the given length, using the</span><span>
</span><span id="line-855"></span><span class="hs-comment">-- specified fill character on the right. Subject to fusion.</span><span>
</span><span id="line-856"></span><span class="hs-comment">-- Performs replacement on invalid scalar values.</span><span>
</span><span id="line-857"></span><span class="hs-comment">--</span><span>
</span><span id="line-858"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-859"></span><span class="hs-comment">--</span><span>
</span><span id="line-860"></span><span class="hs-comment">-- &gt;&gt;&gt; justifyLeft 7 'x' &quot;foo&quot;</span><span>
</span><span id="line-861"></span><span class="hs-comment">-- &quot;fooxxxx&quot;</span><span>
</span><span id="line-862"></span><span class="hs-comment">--</span><span>
</span><span id="line-863"></span><span class="hs-comment">-- &gt;&gt;&gt; justifyLeft 3 'x' &quot;foobar&quot;</span><span>
</span><span id="line-864"></span><span class="hs-comment">-- &quot;foobar&quot;</span><span>
</span><span id="line-865"></span><span class="annot"><a href="Data.Text.html#justifyLeft"><span class="hs-identifier hs-type">justifyLeft</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-866"></span><span id="justifyLeft"><span class="annot"><span class="annottext">justifyLeft :: Int -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#justifyLeft"><span class="hs-identifier hs-var hs-var">justifyLeft</span></a></span></span><span> </span><span id="local-6989586621679110378"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110378"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110377"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110377"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110376"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110376"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-867"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110375"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110378"><span class="hs-identifier hs-var">k</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110376"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-868"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110376"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var">replicateChar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110378"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110375"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110377"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-869"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110375"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110375"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int
</span><a href="Data.Text.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110376"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-870"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#justifyLeft"><span class="hs-pragma hs-type">justifyLeft</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-871"></span><span>
</span><span id="line-872"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-873"></span><span class="annot"><span class="hs-pragma">&quot;TEXT justifyLeft -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110373"><span class="annot"><a href="#local-6989586621679110373"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110372"><span class="annot"><a href="#local-6989586621679110372"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110371"><span class="annot"><a href="#local-6989586621679110371"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-874"></span><span>    </span><span class="annot"><a href="Data.Text.html#justifyLeft"><span class="hs-pragma hs-type">justifyLeft</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110373"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110372"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110371"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#justifyLeftI"><span class="hs-pragma hs-type">S.justifyLeftI</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110373"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110372"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110371"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-875"></span><span class="annot"><span class="hs-pragma">&quot;TEXT justifyLeft -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110369"><span class="annot"><a href="#local-6989586621679110369"><span class="hs-pragma hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110368"><span class="annot"><a href="#local-6989586621679110368"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110367"><span class="annot"><a href="#local-6989586621679110367"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-876"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#justifyLeftI"><span class="hs-pragma hs-type">S.justifyLeftI</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110369"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110368"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110367"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#justifyLeft"><span class="hs-pragma hs-type">justifyLeft</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110369"><span class="hs-pragma hs-type">k</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110368"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110367"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-877"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-878"></span><span>
</span><span id="line-879"></span><span class="hs-comment">-- | /O(n)/ Right-justify a string to the given length, using the</span><span>
</span><span id="line-880"></span><span class="hs-comment">-- specified fill character on the left.  Performs replacement on</span><span>
</span><span id="line-881"></span><span class="hs-comment">-- invalid scalar values.</span><span>
</span><span id="line-882"></span><span class="hs-comment">--</span><span>
</span><span id="line-883"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-884"></span><span class="hs-comment">--</span><span>
</span><span id="line-885"></span><span class="hs-comment">-- &gt;&gt;&gt; justifyRight 7 'x' &quot;bar&quot;</span><span>
</span><span id="line-886"></span><span class="hs-comment">-- &quot;xxxxbar&quot;</span><span>
</span><span id="line-887"></span><span class="hs-comment">--</span><span>
</span><span id="line-888"></span><span class="hs-comment">-- &gt;&gt;&gt; justifyRight 3 'x' &quot;foobar&quot;</span><span>
</span><span id="line-889"></span><span class="hs-comment">-- &quot;foobar&quot;</span><span>
</span><span id="line-890"></span><span class="annot"><a href="Data.Text.html#justifyRight"><span class="hs-identifier hs-type">justifyRight</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-891"></span><span id="justifyRight"><span class="annot"><span class="annottext">justifyRight :: Int -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#justifyRight"><span class="hs-identifier hs-var hs-var">justifyRight</span></a></span></span><span> </span><span id="local-6989586621679110366"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110366"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110365"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110365"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110364"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110364"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-892"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110363"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110366"><span class="hs-identifier hs-var">k</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110364"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-893"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var">replicateChar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110366"><span class="hs-identifier hs-var">k</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110363"><span class="hs-identifier hs-var">len</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110365"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110364"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-894"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110363"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110363"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int
</span><a href="Data.Text.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110364"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-895"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#justifyRight"><span class="hs-pragma hs-type">justifyRight</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-896"></span><span>
</span><span id="line-897"></span><span class="hs-comment">-- | /O(n)/ Center a string to the given length, using the specified</span><span>
</span><span id="line-898"></span><span class="hs-comment">-- fill character on either side.  Performs replacement on invalid</span><span>
</span><span id="line-899"></span><span class="hs-comment">-- scalar values.</span><span>
</span><span id="line-900"></span><span class="hs-comment">--</span><span>
</span><span id="line-901"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-902"></span><span class="hs-comment">--</span><span>
</span><span id="line-903"></span><span class="hs-comment">-- &gt;&gt;&gt; center 8 'x' &quot;HS&quot;</span><span>
</span><span id="line-904"></span><span class="hs-comment">-- &quot;xxxHSxxx&quot;</span><span>
</span><span id="line-905"></span><span class="annot"><a href="Data.Text.html#center"><span class="hs-identifier hs-type">center</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-906"></span><span id="center"><span class="annot"><span class="annottext">center :: Int -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#center"><span class="hs-identifier hs-var hs-var">center</span></a></span></span><span> </span><span id="local-6989586621679110362"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110362"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621679110361"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110361"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110360"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110360"><span class="hs-identifier hs-var">t</span></a></span></span><span>
</span><span id="line-907"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110359"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110362"><span class="hs-identifier hs-var">k</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110360"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-908"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var">replicateChar</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110358"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110361"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110360"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#append"><span class="hs-operator hs-var">`append`</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var">replicateChar</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110357"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110361"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-909"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110359"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110359"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int
</span><a href="Data.Text.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110360"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-910"></span><span>        </span><span id="local-6989586621679110356"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679110356"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110362"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110359"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-911"></span><span>        </span><span id="local-6989586621679110357"><span class="annot"><span class="annottext">r :: Int
</span><a href="#local-6989586621679110357"><span class="hs-identifier hs-var hs-var">r</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110356"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#quot"><span class="hs-operator hs-var">`quot`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-912"></span><span>        </span><span id="local-6989586621679110358"><span class="annot"><span class="annottext">l :: Int
</span><a href="#local-6989586621679110358"><span class="hs-identifier hs-var hs-var">l</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110356"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110357"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-913"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#center"><span class="hs-pragma hs-type">center</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-914"></span><span>
</span><span id="line-915"></span><span class="hs-comment">-- | /O(n)/ The 'transpose' function transposes the rows and columns</span><span>
</span><span id="line-916"></span><span class="hs-comment">-- of its 'Text' argument.  Note that this function uses 'pack',</span><span>
</span><span id="line-917"></span><span class="hs-comment">-- 'unpack', and the list version of transpose, and is thus not very</span><span>
</span><span id="line-918"></span><span class="hs-comment">-- efficient.</span><span>
</span><span id="line-919"></span><span class="hs-comment">--</span><span>
</span><span id="line-920"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-921"></span><span class="hs-comment">--</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- &gt;&gt;&gt; transpose [&quot;green&quot;,&quot;orange&quot;]</span><span>
</span><span id="line-923"></span><span class="hs-comment">-- [&quot;go&quot;,&quot;rr&quot;,&quot;ea&quot;,&quot;en&quot;,&quot;ng&quot;,&quot;e&quot;]</span><span>
</span><span id="line-924"></span><span class="hs-comment">--</span><span>
</span><span id="line-925"></span><span class="hs-comment">-- &gt;&gt;&gt; transpose [&quot;blue&quot;,&quot;red&quot;]</span><span>
</span><span id="line-926"></span><span class="hs-comment">-- [&quot;br&quot;,&quot;le&quot;,&quot;ud&quot;,&quot;e&quot;]</span><span>
</span><span id="line-927"></span><span class="annot"><a href="Data.Text.html#transpose"><span class="hs-identifier hs-type">transpose</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-928"></span><span id="transpose"><span class="annot"><span class="annottext">transpose :: [Text] -&gt; [Text]
</span><a href="Data.Text.html#transpose"><span class="hs-identifier hs-var hs-var">transpose</span></a></span></span><span> </span><span id="local-6989586621679110355"><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110355"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; [String] -&gt; [Text]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">P.map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><a href="Data.Text.html#pack"><span class="hs-identifier hs-var">pack</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. [[a]] -&gt; [[a]]
</span><a href="../../base/src/Data.OldList.html#transpose"><span class="hs-identifier hs-var">L.transpose</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Text -&gt; String) -&gt; [Text] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">P.map</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; String
</span><a href="Data.Text.Show.html#unpack"><span class="hs-identifier hs-var">unpack</span></a></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110355"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-929"></span><span>
</span><span id="line-930"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-931"></span><span class="hs-comment">-- * Reducing 'Text's (folds)</span><span>
</span><span id="line-932"></span><span>
</span><span id="line-933"></span><span class="hs-comment">-- | /O(n)/ 'foldl', applied to a binary operator, a starting value</span><span>
</span><span id="line-934"></span><span class="hs-comment">-- (typically the left-identity of the operator), and a 'Text',</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- reduces the 'Text' using the binary operator, from left to right.</span><span>
</span><span id="line-936"></span><span class="hs-comment">-- Subject to fusion.</span><span>
</span><span id="line-937"></span><span id="local-6989586621679111212"><span class="annot"><a href="Data.Text.html#foldl"><span class="hs-identifier hs-type">foldl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111212"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111212"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111212"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111212"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-938"></span><span id="foldl"><span class="annot"><span class="annottext">foldl :: forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.html#foldl"><span class="hs-identifier hs-var hs-var">foldl</span></a></span></span><span> </span><span id="local-6989586621679110353"><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679110353"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110352"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110352"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110351"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110351"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; a) -&gt; a -&gt; Stream Char -&gt; a
forall b. (b -&gt; Char -&gt; b) -&gt; b -&gt; Stream Char -&gt; b
</span><a href="Data.Text.Internal.Fusion.Common.html#foldl"><span class="hs-identifier hs-var">S.foldl</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679110353"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110352"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110351"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-939"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldl"><span class="hs-pragma hs-type">foldl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-940"></span><span>
</span><span id="line-941"></span><span class="hs-comment">-- | /O(n)/ A strict version of 'foldl'.  Subject to fusion.</span><span>
</span><span id="line-942"></span><span id="local-6989586621679110349"><span class="annot"><a href="Data.Text.html#foldl%27"><span class="hs-identifier hs-type">foldl'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679110349"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679110349"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679110349"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679110349"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-943"></span><span id="foldl%27"><span class="annot"><span class="annottext">foldl' :: forall a. (a -&gt; Char -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.html#foldl%27"><span class="hs-identifier hs-var hs-var">foldl'</span></a></span></span><span> </span><span id="local-6989586621679110348"><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679110348"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110347"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110347"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110346"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110346"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; a) -&gt; a -&gt; Stream Char -&gt; a
forall b. (b -&gt; Char -&gt; b) -&gt; b -&gt; Stream Char -&gt; b
</span><a href="Data.Text.Internal.Fusion.Common.html#foldl%27"><span class="hs-identifier hs-var">S.foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; a
</span><a href="#local-6989586621679110348"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110347"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110346"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-944"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldl%27"><span class="hs-pragma hs-type">foldl'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-945"></span><span>
</span><span id="line-946"></span><span class="hs-comment">-- | /O(n)/ A variant of 'foldl' that has no starting value argument,</span><span>
</span><span id="line-947"></span><span class="hs-comment">-- and thus must be applied to a non-empty 'Text'.  Subject to fusion.</span><span>
</span><span id="line-948"></span><span class="annot"><a href="Data.Text.html#foldl1"><span class="hs-identifier hs-type">foldl1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-949"></span><span id="foldl1"><span class="annot"><span class="annottext">foldl1 :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Char
</span><a href="Data.Text.html#foldl1"><span class="hs-identifier hs-var hs-var">foldl1</span></a></span></span><span> </span><span id="local-6989586621679110344"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110344"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110343"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110343"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#foldl1"><span class="hs-identifier hs-var">S.foldl1</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110344"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110343"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-950"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldl1"><span class="hs-pragma hs-type">foldl1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-951"></span><span>
</span><span id="line-952"></span><span class="hs-comment">-- | /O(n)/ A strict version of 'foldl1'.  Subject to fusion.</span><span>
</span><span id="line-953"></span><span class="annot"><a href="Data.Text.html#foldl1%27"><span class="hs-identifier hs-type">foldl1'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-954"></span><span id="foldl1%27"><span class="annot"><span class="annottext">foldl1' :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Char
</span><a href="Data.Text.html#foldl1%27"><span class="hs-identifier hs-var hs-var">foldl1'</span></a></span></span><span> </span><span id="local-6989586621679110341"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110341"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110340"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110340"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#foldl1%27"><span class="hs-identifier hs-var">S.foldl1'</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110341"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110340"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-955"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldl1%27"><span class="hs-pragma hs-type">foldl1'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-956"></span><span>
</span><span id="line-957"></span><span class="hs-comment">-- | /O(n)/ 'foldr', applied to a binary operator, a starting value</span><span>
</span><span id="line-958"></span><span class="hs-comment">-- (typically the right-identity of the operator), and a 'Text',</span><span>
</span><span id="line-959"></span><span class="hs-comment">-- reduces the 'Text' using the binary operator, from right to left.</span><span>
</span><span id="line-960"></span><span class="hs-comment">-- Subject to fusion.</span><span>
</span><span id="line-961"></span><span id="local-6989586621679111208"><span class="annot"><a href="Data.Text.html#foldr"><span class="hs-identifier hs-type">foldr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111208"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111208"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111208"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111208"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-962"></span><span id="foldr"><span class="annot"><span class="annottext">foldr :: forall a. (Char -&gt; a -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.html#foldr"><span class="hs-identifier hs-var hs-var">foldr</span></a></span></span><span> </span><span id="local-6989586621679110338"><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679110338"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110337"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110337"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110336"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110336"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; a -&gt; a) -&gt; a -&gt; Stream Char -&gt; a
forall b. (Char -&gt; b -&gt; b) -&gt; b -&gt; Stream Char -&gt; b
</span><a href="Data.Text.Internal.Fusion.Common.html#foldr"><span class="hs-identifier hs-var">S.foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; a -&gt; a
</span><a href="#local-6989586621679110338"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110337"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110336"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-963"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldr"><span class="hs-pragma hs-type">foldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-964"></span><span>
</span><span id="line-965"></span><span class="hs-comment">-- | /O(n)/ A variant of 'foldr' that has no starting value argument,</span><span>
</span><span id="line-966"></span><span class="hs-comment">-- and thus must be applied to a non-empty 'Text'.  Subject to</span><span>
</span><span id="line-967"></span><span class="hs-comment">-- fusion.</span><span>
</span><span id="line-968"></span><span class="annot"><a href="Data.Text.html#foldr1"><span class="hs-identifier hs-type">foldr1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-969"></span><span id="foldr1"><span class="annot"><span class="annottext">foldr1 :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Char
</span><a href="Data.Text.html#foldr1"><span class="hs-identifier hs-var hs-var">foldr1</span></a></span></span><span> </span><span id="local-6989586621679110334"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110334"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110333"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110333"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#foldr1"><span class="hs-identifier hs-var">S.foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110334"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110333"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#foldr1"><span class="hs-pragma hs-type">foldr1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-971"></span><span>
</span><span id="line-972"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-973"></span><span class="hs-comment">-- ** Special folds</span><span>
</span><span id="line-974"></span><span>
</span><span id="line-975"></span><span class="hs-comment">-- | /O(n)/ Concatenate a list of 'Text's.</span><span>
</span><span id="line-976"></span><span class="annot"><a href="Data.Text.html#concat"><span class="hs-identifier hs-type">concat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-977"></span><span id="concat"><span class="annot"><span class="annottext">concat :: [Text] -&gt; Text
</span><a href="Data.Text.html#concat"><span class="hs-identifier hs-var hs-var">concat</span></a></span></span><span> </span><span id="local-6989586621679110331"><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110331"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110330"><span class="hs-identifier hs-var">ts'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-978"></span><span>              </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-979"></span><span>              </span><span class="hs-special">[</span><span id="local-6989586621679110329"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110329"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110329"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-980"></span><span>              </span><span class="annot"><span class="annottext">[Text]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s (MArray s)) -&gt; Array
</span><a href="Data.Text.Array.html#run"><span class="hs-identifier hs-var">A.run</span></a></span><span> </span><span class="annot"><span class="annottext">forall s. ST s (MArray s)
</span><a href="#local-6989586621679110328"><span class="hs-identifier hs-var">go</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110327"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-981"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-982"></span><span>    </span><span id="local-6989586621679110330"><span class="annot"><span class="annottext">ts' :: [Text]
</span><a href="#local-6989586621679110330"><span class="hs-identifier hs-var hs-var">ts'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Bool) -&gt; [Text] -&gt; [Text]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">L.filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Text -&gt; Bool) -&gt; Text -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110331"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-983"></span><span>    </span><span id="local-6989586621679110327"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110327"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Int] -&gt; Int
</span><a href="Data.Text.html#sumP"><span class="hs-identifier hs-var">sumP</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;concat&quot;</span></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; Int) -&gt; [Int] -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Int) -&gt; [Text] -&gt; [Int]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int
</span><a href="Data.Text.Unsafe.html#lengthWord16"><span class="hs-identifier hs-var">lengthWord16</span></a></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110330"><span class="hs-identifier hs-var">ts'</span></a></span><span>
</span><span id="line-984"></span><span>    </span><span id="local-6989586621679110325"><span class="annot"><a href="#local-6989586621679110328"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110325"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110325"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-985"></span><span>    </span><span id="local-6989586621679110328"><span class="annot"><span class="annottext">go :: forall s. ST s (MArray s)
</span><a href="#local-6989586621679110328"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-986"></span><span>      </span><span id="local-6989586621679110315"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110315"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110327"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-987"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110314"><span class="annot"><span class="annottext">step :: Int -&gt; Text -&gt; ST s Int
</span><a href="#local-6989586621679110314"><span class="hs-identifier hs-var hs-var">step</span></a></span></span><span> </span><span id="local-6989586621679110313"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110313"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110312"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110312"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110311"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110311"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679110310"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110310"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-988"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110309"><span class="annot"><span class="annottext">j :: Int
</span><a href="#local-6989586621679110309"><span class="hs-identifier hs-var hs-var">j</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110313"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110310"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110315"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110313"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110312"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110311"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110309"><span class="hs-identifier hs-var">j</span></a></span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s Int -&gt; ST s Int
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s Int
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110309"><span class="hs-identifier hs-var">j</span></a></span><span>
</span><span id="line-989"></span><span>      </span><span class="annot"><span class="annottext">(Int -&gt; Text -&gt; ST s Int) -&gt; Int -&gt; [Text] -&gt; ST s Int
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; ST s Int
</span><a href="#local-6989586621679110314"><span class="hs-identifier hs-var">step</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679110330"><span class="hs-identifier hs-var">ts'</span></a></span><span> </span><span class="annot"><span class="annottext">ST s Int -&gt; ST s (MArray s) -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110315"><span class="hs-identifier hs-var">arr</span></a></span><span>
</span><span id="line-990"></span><span>
</span><span id="line-991"></span><span class="hs-comment">-- | /O(n)/ Map a function over a 'Text' that results in a 'Text', and</span><span>
</span><span id="line-992"></span><span class="hs-comment">-- concatenate the results.</span><span>
</span><span id="line-993"></span><span class="annot"><a href="Data.Text.html#concatMap"><span class="hs-identifier hs-type">concatMap</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-994"></span><span id="concatMap"><span class="annot"><span class="annottext">concatMap :: (Char -&gt; Text) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#concatMap"><span class="hs-identifier hs-var hs-var">concatMap</span></a></span></span><span> </span><span id="local-6989586621679110308"><span class="annot"><span class="annottext">Char -&gt; Text
</span><a href="#local-6989586621679110308"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Text
</span><a href="Data.Text.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; Text) -&gt; (Text -&gt; [Text]) -&gt; Text -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; [Text] -&gt; [Text]) -&gt; [Text] -&gt; Text -&gt; [Text]
forall a. (Char -&gt; a -&gt; a) -&gt; a -&gt; Text -&gt; a
</span><a href="Data.Text.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Text -&gt; [Text] -&gt; [Text])
-&gt; (Char -&gt; Text) -&gt; Char -&gt; [Text] -&gt; [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Text
</span><a href="#local-6989586621679110308"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-995"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#concatMap"><span class="hs-pragma hs-type">concatMap</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span class="hs-comment">-- | /O(n)/ 'any' @p@ @t@ determines whether any character in the</span><span>
</span><span id="line-998"></span><span class="hs-comment">-- 'Text' @t@ satisfies the predicate @p@. Subject to fusion.</span><span>
</span><span id="line-999"></span><span class="annot"><a href="Data.Text.html#any"><span class="hs-identifier hs-type">any</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1000"></span><span id="any"><span class="annot"><span class="annottext">any :: (Char -&gt; Bool) -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#any"><span class="hs-identifier hs-var hs-var">any</span></a></span></span><span> </span><span id="local-6989586621679110307"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110307"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110306"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110306"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#any"><span class="hs-identifier hs-var">S.any</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110307"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110306"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1001"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#any"><span class="hs-pragma hs-type">any</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1002"></span><span>
</span><span id="line-1003"></span><span class="hs-comment">-- | /O(n)/ 'all' @p@ @t@ determines whether all characters in the</span><span>
</span><span id="line-1004"></span><span class="hs-comment">-- 'Text' @t@ satisfy the predicate @p@. Subject to fusion.</span><span>
</span><span id="line-1005"></span><span class="annot"><a href="Data.Text.html#all"><span class="hs-identifier hs-type">all</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1006"></span><span id="all"><span class="annot"><span class="annottext">all :: (Char -&gt; Bool) -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#all"><span class="hs-identifier hs-var hs-var">all</span></a></span></span><span> </span><span id="local-6989586621679110304"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110304"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110303"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110303"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#all"><span class="hs-identifier hs-var">S.all</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110304"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110303"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1007"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#all"><span class="hs-pragma hs-type">all</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span class="hs-comment">-- | /O(n)/ 'maximum' returns the maximum value from a 'Text', which</span><span>
</span><span id="line-1010"></span><span class="hs-comment">-- must be non-empty. Subject to fusion.</span><span>
</span><span id="line-1011"></span><span class="annot"><a href="Data.Text.html#maximum"><span class="hs-identifier hs-type">maximum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-1012"></span><span id="maximum"><span class="annot"><span class="annottext">maximum :: Text -&gt; Char
</span><a href="Data.Text.html#maximum"><span class="hs-identifier hs-var hs-var">maximum</span></a></span></span><span> </span><span id="local-6989586621679110301"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110301"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#maximum"><span class="hs-identifier hs-var">S.maximum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110301"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1013"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#maximum"><span class="hs-pragma hs-type">maximum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1014"></span><span>
</span><span id="line-1015"></span><span class="hs-comment">-- | /O(n)/ 'minimum' returns the minimum value from a 'Text', which</span><span>
</span><span id="line-1016"></span><span class="hs-comment">-- must be non-empty. Subject to fusion.</span><span>
</span><span id="line-1017"></span><span class="annot"><a href="Data.Text.html#minimum"><span class="hs-identifier hs-type">minimum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-1018"></span><span id="minimum"><span class="annot"><span class="annottext">minimum :: Text -&gt; Char
</span><a href="Data.Text.html#minimum"><span class="hs-identifier hs-var hs-var">minimum</span></a></span></span><span> </span><span id="local-6989586621679110299"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110299"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Char
</span><a href="Data.Text.Internal.Fusion.Common.html#minimum"><span class="hs-identifier hs-var">S.minimum</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110299"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1019"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#minimum"><span class="hs-pragma hs-type">minimum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1020"></span><span>
</span><span id="line-1021"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-1022"></span><span class="hs-comment">-- * Building 'Text's</span><span>
</span><span id="line-1023"></span><span>
</span><span id="line-1024"></span><span class="hs-comment">-- | /O(n)/ 'scanl' is similar to 'foldl', but returns a list of</span><span>
</span><span id="line-1025"></span><span class="hs-comment">-- successive reduced values from the left. Subject to fusion.</span><span>
</span><span id="line-1026"></span><span class="hs-comment">-- Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1027"></span><span class="hs-comment">--</span><span>
</span><span id="line-1028"></span><span class="hs-comment">-- &gt; scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]</span><span>
</span><span id="line-1029"></span><span class="hs-comment">--</span><span>
</span><span id="line-1030"></span><span class="hs-comment">-- Note that</span><span>
</span><span id="line-1031"></span><span class="hs-comment">--</span><span>
</span><span id="line-1032"></span><span class="hs-comment">-- &gt; last (scanl f z xs) == foldl f z xs.</span><span>
</span><span id="line-1033"></span><span class="annot"><a href="Data.Text.html#scanl"><span class="hs-identifier hs-type">scanl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1034"></span><span id="scanl"><span class="annot"><span class="annottext">scanl :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanl"><span class="hs-identifier hs-var hs-var">scanl</span></a></span></span><span> </span><span id="local-6989586621679110297"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110297"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110296"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110296"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621679110295"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110295"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#scanl"><span class="hs-identifier hs-var">S.scanl</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110293"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110296"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110295"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1035"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110293"><span class="annot"><span class="annottext">g :: Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110293"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679110292"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110292"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110291"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110291"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110297"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110292"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110291"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1036"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#scanl"><span class="hs-pragma hs-type">scanl</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1037"></span><span>
</span><span id="line-1038"></span><span class="hs-comment">-- | /O(n)/ 'scanl1' is a variant of 'scanl' that has no starting</span><span>
</span><span id="line-1039"></span><span class="hs-comment">-- value argument. Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1040"></span><span class="hs-comment">--</span><span>
</span><span id="line-1041"></span><span class="hs-comment">-- &gt; scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]</span><span>
</span><span id="line-1042"></span><span class="annot"><a href="Data.Text.html#scanl1"><span class="hs-identifier hs-type">scanl1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1043"></span><span id="scanl1"><span class="annot"><span class="annottext">scanl1 :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanl1"><span class="hs-identifier hs-var hs-var">scanl1</span></a></span></span><span> </span><span id="local-6989586621679110290"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110290"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110289"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110289"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110289"><span class="hs-identifier hs-var">t</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1044"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanl"><span class="hs-identifier hs-var">scanl</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110290"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110289"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110289"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1045"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#scanl1"><span class="hs-pragma hs-type">scanl1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1046"></span><span>
</span><span id="line-1047"></span><span class="hs-comment">-- | /O(n)/ 'scanr' is the right-to-left dual of 'scanl'.  Performs</span><span>
</span><span id="line-1048"></span><span class="hs-comment">-- replacement on invalid scalar values.</span><span>
</span><span id="line-1049"></span><span class="hs-comment">--</span><span>
</span><span id="line-1050"></span><span class="hs-comment">-- &gt; scanr f v == reverse . scanl (flip f) v . reverse</span><span>
</span><span id="line-1051"></span><span class="annot"><a href="Data.Text.html#scanr"><span class="hs-identifier hs-type">scanr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1052"></span><span id="scanr"><span class="annot"><span class="annottext">scanr :: (Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanr"><span class="hs-identifier hs-var hs-var">scanr</span></a></span></span><span> </span><span id="local-6989586621679110288"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110288"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110287"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110287"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#reverse"><span class="hs-identifier hs-var">S.reverse</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Text) -&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#reverseScanr"><span class="hs-identifier hs-var">S.reverseScanr</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110285"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110287"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Stream Char)
-&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; Stream Char
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#reverseStream"><span class="hs-identifier hs-var">reverseStream</span></a></span><span>
</span><span id="line-1053"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110285"><span class="annot"><span class="annottext">g :: Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110285"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679110284"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110284"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110283"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110283"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110288"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110284"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110283"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1054"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#scanr"><span class="hs-pragma hs-type">scanr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1055"></span><span>
</span><span id="line-1056"></span><span class="hs-comment">-- | /O(n)/ 'scanr1' is a variant of 'scanr' that has no starting</span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- value argument. Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1058"></span><span class="annot"><a href="Data.Text.html#scanr1"><span class="hs-identifier hs-type">scanr1</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1059"></span><span id="scanr1"><span class="annot"><span class="annottext">scanr1 :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanr1"><span class="hs-identifier hs-var hs-var">scanr1</span></a></span></span><span> </span><span id="local-6989586621679110282"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110282"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110281"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110281"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110281"><span class="hs-identifier hs-var">t</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1060"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Char -&gt; Text -&gt; Text
</span><a href="Data.Text.html#scanr"><span class="hs-identifier hs-var">scanr</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110282"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.html#last"><span class="hs-identifier hs-var">last</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110281"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#init"><span class="hs-identifier hs-var">init</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110281"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1061"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#scanr1"><span class="hs-pragma hs-type">scanr1</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1062"></span><span>
</span><span id="line-1063"></span><span class="hs-comment">-- | /O(n)/ Like a combination of 'map' and 'foldl''. Applies a</span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- function to each element of a 'Text', passing an accumulating</span><span>
</span><span id="line-1065"></span><span class="hs-comment">-- parameter from left to right, and returns a final 'Text'.  Performs</span><span>
</span><span id="line-1066"></span><span class="hs-comment">-- replacement on invalid scalar values.</span><span>
</span><span id="line-1067"></span><span id="local-6989586621679111197"><span class="annot"><a href="Data.Text.html#mapAccumL"><span class="hs-identifier hs-type">mapAccumL</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111197"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111197"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111197"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111197"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1068"></span><span id="mapAccumL"><span class="annot"><span class="annottext">mapAccumL :: forall a. (a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Text -&gt; (a, Text)
</span><a href="Data.Text.html#mapAccumL"><span class="hs-identifier hs-var hs-var">mapAccumL</span></a></span></span><span> </span><span id="local-6989586621679110280"><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110280"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110279"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110279"><span class="hs-identifier hs-var">z0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Stream Char -&gt; (a, Text)
forall a. (a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Stream Char -&gt; (a, Text)
</span><a href="Data.Text.Internal.Fusion.html#mapAccumL"><span class="hs-identifier hs-var">S.mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110277"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110279"><span class="hs-identifier hs-var">z0</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; (a, Text))
-&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; (a, Text)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span>
</span><span id="line-1069"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110277"><span class="annot"><span class="annottext">g :: a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110277"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679110276"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110276"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110275"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110275"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; (a, Char) -&gt; (a, Char)
forall b c a. (b -&gt; c) -&gt; (a, b) -&gt; (a, c)
</span><a href="Data.Text.html#second"><span class="hs-identifier hs-var">second</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110280"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110276"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110275"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1070"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#mapAccumL"><span class="hs-pragma hs-type">mapAccumL</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1071"></span><span>
</span><span id="line-1072"></span><span class="hs-comment">-- | The 'mapAccumR' function behaves like a combination of 'map' and</span><span>
</span><span id="line-1073"></span><span class="hs-comment">-- a strict 'foldr'; it applies a function to each element of a</span><span>
</span><span id="line-1074"></span><span class="hs-comment">-- 'Text', passing an accumulating parameter from right to left, and</span><span>
</span><span id="line-1075"></span><span class="hs-comment">-- returning a final value of this accumulator together with the new</span><span>
</span><span id="line-1076"></span><span class="hs-comment">-- 'Text'.</span><span>
</span><span id="line-1077"></span><span class="hs-comment">-- Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1078"></span><span id="local-6989586621679110274"><span class="annot"><a href="Data.Text.html#mapAccumR"><span class="hs-identifier hs-type">mapAccumR</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679110274"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679110274"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679110274"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679110274"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1079"></span><span id="mapAccumR"><span class="annot"><span class="annottext">mapAccumR :: forall a. (a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Text -&gt; (a, Text)
</span><a href="Data.Text.html#mapAccumR"><span class="hs-identifier hs-var hs-var">mapAccumR</span></a></span></span><span> </span><span id="local-6989586621679110273"><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110273"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110272"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110272"><span class="hs-identifier hs-var">z0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Text) -&gt; (a, Text) -&gt; (a, Text)
forall b c a. (b -&gt; c) -&gt; (a, b) -&gt; (a, c)
</span><a href="Data.Text.html#second"><span class="hs-identifier hs-var">second</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">((a, Text) -&gt; (a, Text))
-&gt; (Text -&gt; (a, Text)) -&gt; Text -&gt; (a, Text)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Stream Char -&gt; (a, Text)
forall a. (a -&gt; Char -&gt; (a, Char)) -&gt; a -&gt; Stream Char -&gt; (a, Text)
</span><a href="Data.Text.Internal.Fusion.html#mapAccumL"><span class="hs-identifier hs-var">S.mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110271"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110272"><span class="hs-identifier hs-var">z0</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; (a, Text))
-&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; (a, Text)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#reverseStream"><span class="hs-identifier hs-var">reverseStream</span></a></span><span>
</span><span id="line-1080"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110271"><span class="annot"><span class="annottext">g :: a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110271"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679110270"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110270"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110269"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110269"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; (a, Char) -&gt; (a, Char)
forall b c a. (b -&gt; c) -&gt; (a, b) -&gt; (a, c)
</span><a href="Data.Text.html#second"><span class="hs-identifier hs-var">second</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Char -&gt; (a, Char)
</span><a href="#local-6989586621679110273"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110270"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110269"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1081"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#mapAccumR"><span class="hs-pragma hs-type">mapAccumR</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1082"></span><span>
</span><span id="line-1083"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-1084"></span><span class="hs-comment">-- ** Generating and unfolding 'Text's</span><span>
</span><span id="line-1085"></span><span>
</span><span id="line-1086"></span><span class="hs-comment">-- | /O(n*m)/ 'replicate' @n@ @t@ is a 'Text' consisting of the input</span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- @t@ repeated @n@ times.</span><span>
</span><span id="line-1088"></span><span class="annot"><a href="Data.Text.html#replicate"><span class="hs-identifier hs-type">replicate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1089"></span><span id="replicate"><span class="annot"><span class="annottext">replicate :: Int -&gt; Text -&gt; Text
</span><a href="Data.Text.html#replicate"><span class="hs-identifier hs-var hs-var">replicate</span></a></span></span><span> </span><span id="local-6989586621679110268"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110268"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110267"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110267"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110266"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110266"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110265"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110265"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span id="local-6989586621679110264"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110264"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1090"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110268"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110264"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1091"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110268"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110267"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1092"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110267"><span class="hs-identifier hs-var">t</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var">replicateChar</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110268"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110267"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1093"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s (MArray s)) -&gt; Array
</span><a href="Data.Text.Array.html#run"><span class="hs-identifier hs-var">A.run</span></a></span><span> </span><span class="annot"><span class="annottext">forall s. ST s (MArray s)
</span><a href="#local-6989586621679110263"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110262"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1094"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1095"></span><span>    </span><span id="local-6989586621679110262"><span class="annot"><span class="annottext">len :: Int
</span><a href="#local-6989586621679110262"><span class="hs-identifier hs-var hs-var">len</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110264"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="Data.Text.Internal.html#mul"><span class="hs-operator hs-var">`mul`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110268"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-comment">-- TODO: detect overflows</span><span>
</span><span id="line-1096"></span><span>    </span><span id="local-6989586621679110261"><span class="annot"><a href="#local-6989586621679110263"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110261"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110261"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1097"></span><span>    </span><span id="local-6989586621679110263"><span class="annot"><span class="annottext">x :: forall s. ST s (MArray s)
</span><a href="#local-6989586621679110263"><span class="hs-identifier hs-var hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1098"></span><span>      </span><span id="local-6989586621679110251"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110262"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1099"></span><span>      </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110266"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110265"><span class="hs-identifier hs-var">o</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110264"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1100"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110250"><span class="annot"><span class="annottext">loop :: Int -&gt; ST s (MArray s)
</span><a href="#local-6989586621679110250"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110249"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1101"></span><span>            </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110248"><span class="annot"><span class="annottext">rest :: Int
</span><a href="#local-6989586621679110248"><span class="hs-identifier hs-var hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110262"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-1102"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110248"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; MArray s -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; MArray s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyM"><span class="hs-identifier hs-var">A.copyM</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110248"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s (MArray s) -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span>
</span><span id="line-1103"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; MArray s -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; MArray s -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyM"><span class="hs-identifier hs-var">A.copyM</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679110251"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">ST s () -&gt; ST s (MArray s) -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
</span><a href="#local-6989586621679110250"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110249"><span class="hs-identifier hs-var">l1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. UnsafeShift a =&gt; a -&gt; Int -&gt; a
</span><a href="Data.Text.Internal.Unsafe.Shift.html#shiftL"><span class="hs-operator hs-var">`shiftL`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1104"></span><span>      </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
</span><a href="#local-6989586621679110250"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110264"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1105"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#replicate"><span class="hs-pragma hs-type">replicate</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1106"></span><span>
</span><span id="line-1107"></span><span>
</span><span id="line-1108"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1109"></span><span class="annot"><span class="hs-pragma">&quot;TEXT replicate/singleton -&gt; replicateChar&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110245"><span class="annot"><a href="#local-6989586621679110245"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110244"><span class="annot"><a href="#local-6989586621679110244"><span class="hs-pragma hs-var">c</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1110"></span><span>    </span><span class="annot"><a href="Data.Text.html#replicate"><span class="hs-pragma hs-type">replicate</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110245"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110244"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#replicateChar"><span class="hs-pragma hs-type">replicateChar</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110245"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110244"><span class="hs-pragma hs-type">c</span></a></span><span>
</span><span id="line-1111"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1112"></span><span>
</span><span id="line-1113"></span><span class="hs-comment">-- | /O(n)/ 'replicateChar' @n@ @c@ is a 'Text' of length @n@ with @c@ the</span><span>
</span><span id="line-1114"></span><span class="hs-comment">-- value of every element. Subject to fusion.</span><span>
</span><span id="line-1115"></span><span class="annot"><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-type">replicateChar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1116"></span><span id="replicateChar"><span class="annot"><span class="annottext">replicateChar :: Int -&gt; Char -&gt; Text
</span><a href="Data.Text.html#replicateChar"><span class="hs-identifier hs-var hs-var">replicateChar</span></a></span></span><span> </span><span id="local-6989586621679110243"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110243"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110242"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110242"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Char -&gt; Stream Char
forall a. Integral a =&gt; a -&gt; Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#replicateCharI"><span class="hs-identifier hs-var">S.replicateCharI</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110243"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110242"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1117"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#replicateChar"><span class="hs-pragma hs-type">replicateChar</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1118"></span><span>
</span><span id="line-1119"></span><span class="hs-comment">-- | /O(n)/, where @n@ is the length of the result. The 'unfoldr'</span><span>
</span><span id="line-1120"></span><span class="hs-comment">-- function is analogous to the List 'L.unfoldr'. 'unfoldr' builds a</span><span>
</span><span id="line-1121"></span><span class="hs-comment">-- 'Text' from a seed value. The function takes the element and</span><span>
</span><span id="line-1122"></span><span class="hs-comment">-- returns 'Nothing' if it is done producing the 'Text', otherwise</span><span>
</span><span id="line-1123"></span><span class="hs-comment">-- 'Just' @(a,b)@.  In this case, @a@ is the next 'Char' in the</span><span>
</span><span id="line-1124"></span><span class="hs-comment">-- string, and @b@ is the seed value for further production. Subject</span><span>
</span><span id="line-1125"></span><span class="hs-comment">-- to fusion.  Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1126"></span><span id="local-6989586621679111188"><span class="annot"><a href="Data.Text.html#unfoldr"><span class="hs-identifier hs-type">unfoldr</span></a></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111188"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679111188"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111188"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span>
</span><span id="line-1127"></span><span id="unfoldr"><span class="annot"><span class="annottext">unfoldr :: forall a. (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Text
</span><a href="Data.Text.html#unfoldr"><span class="hs-identifier hs-var hs-var">unfoldr</span></a></span></span><span> </span><span id="local-6989586621679110240"><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679110240"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110239"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110239"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe (Char, a)) -&gt; a -&gt; Stream Char
forall a. (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#unfoldr"><span class="hs-identifier hs-var">S.unfoldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; Maybe (Char, a) -&gt; Maybe (Char, a)
forall a c b. (a -&gt; c) -&gt; Maybe (a, b) -&gt; Maybe (c, b)
</span><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier hs-var">firstf</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (Char, a) -&gt; Maybe (Char, a))
-&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Maybe (Char, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679110240"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110239"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1128"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#unfoldr"><span class="hs-pragma hs-type">unfoldr</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1129"></span><span>
</span><span id="line-1130"></span><span class="hs-comment">-- | /O(n)/ Like 'unfoldr', 'unfoldrN' builds a 'Text' from a seed</span><span>
</span><span id="line-1131"></span><span class="hs-comment">-- value. However, the length of the result should be limited by the</span><span>
</span><span id="line-1132"></span><span class="hs-comment">-- first argument to 'unfoldrN'. This function is more efficient than</span><span>
</span><span id="line-1133"></span><span class="hs-comment">-- 'unfoldr' when the maximum length of the result is known and</span><span>
</span><span id="line-1134"></span><span class="hs-comment">-- correct, otherwise its performance is similar to 'unfoldr'. Subject</span><span>
</span><span id="line-1135"></span><span class="hs-comment">-- to fusion.  Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1136"></span><span id="local-6989586621679111182"><span class="annot"><a href="Data.Text.html#unfoldrN"><span class="hs-identifier hs-type">unfoldrN</span></a></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679111182"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679111182"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111182"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span></span><span>
</span><span id="line-1137"></span><span id="unfoldrN"><span class="annot"><span class="annottext">unfoldrN :: forall a. Int -&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Text
</span><a href="Data.Text.html#unfoldrN"><span class="hs-identifier hs-var hs-var">unfoldrN</span></a></span></span><span> </span><span id="local-6989586621679110237"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110237"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110236"><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679110236"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110235"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110235"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Stream Char
forall a. Int -&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#unfoldrN"><span class="hs-identifier hs-var">S.unfoldrN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110237"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Char) -&gt; Maybe (Char, a) -&gt; Maybe (Char, a)
forall a c b. (a -&gt; c) -&gt; Maybe (a, b) -&gt; Maybe (c, b)
</span><a href="Data.Text.Internal.html#firstf"><span class="hs-identifier hs-var">firstf</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (Char, a) -&gt; Maybe (Char, a))
-&gt; (a -&gt; Maybe (Char, a)) -&gt; a -&gt; Maybe (Char, a)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe (Char, a)
</span><a href="#local-6989586621679110236"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679110235"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1138"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#unfoldrN"><span class="hs-pragma hs-type">unfoldrN</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1139"></span><span>
</span><span id="line-1140"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-1141"></span><span class="hs-comment">-- * Substrings</span><span>
</span><span id="line-1142"></span><span>
</span><span id="line-1143"></span><span class="hs-comment">-- | /O(n)/ 'take' @n@, applied to a 'Text', returns the prefix of the</span><span>
</span><span id="line-1144"></span><span class="hs-comment">-- 'Text' of length @n@, or the 'Text' itself if @n@ is greater than</span><span>
</span><span id="line-1145"></span><span class="hs-comment">-- the length of the Text. Subject to fusion.</span><span>
</span><span id="line-1146"></span><span class="annot"><a href="Data.Text.html#take"><span class="hs-identifier hs-type">take</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1147"></span><span id="take"><span class="annot"><span class="annottext">take :: Int -&gt; Text -&gt; Text
</span><a href="Data.Text.html#take"><span class="hs-identifier hs-var hs-var">take</span></a></span></span><span> </span><span id="local-6989586621679110233"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110233"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110232"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110232"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110231"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110231"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110230"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110230"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110229"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110229"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1148"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110233"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1149"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110233"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110229"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110232"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1150"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110231"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110230"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterN"><span class="hs-identifier hs-var">iterN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110233"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110232"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1151"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1152"></span><span>
</span><span id="line-1153"></span><span class="annot"><a href="Data.Text.html#iterN"><span class="hs-identifier hs-type">iterN</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1154"></span><span id="iterN"><span class="annot"><span class="annottext">iterN :: Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterN"><span class="hs-identifier hs-var hs-var">iterN</span></a></span></span><span> </span><span id="local-6989586621679110227"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110227"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110226"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110226"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110225"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110225"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679110224"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110224"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679110223"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110223"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110222"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1155"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110222"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110222"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110221"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110221"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110220"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110220"><span class="hs-identifier hs-var">cnt</span></a></span></span><span>
</span><span id="line-1156"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110221"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110223"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110220"><span class="hs-identifier hs-var">cnt</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110227"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110221"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1157"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110222"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110221"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110219"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110220"><span class="hs-identifier hs-var">cnt</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1158"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110219"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679110219"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Int
</span><a href="Data.Text.Unsafe.html#iter_"><span class="hs-identifier hs-var">iter_</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110226"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110221"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1159"></span><span>
</span><span id="line-1160"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1161"></span><span class="annot"><span class="hs-pragma">&quot;TEXT take -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110218"><span class="annot"><a href="#local-6989586621679110218"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110217"><span class="annot"><a href="#local-6989586621679110217"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1162"></span><span>    </span><span class="annot"><a href="Data.Text.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110218"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110217"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#take"><span class="hs-pragma hs-type">S.take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110218"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110217"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-1163"></span><span class="annot"><span class="hs-pragma">&quot;TEXT take -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110215"><span class="annot"><a href="#local-6989586621679110215"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110214"><span class="annot"><a href="#local-6989586621679110214"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1164"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#take"><span class="hs-pragma hs-type">S.take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110215"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110214"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110215"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110214"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1165"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1166"></span><span>
</span><span id="line-1167"></span><span class="hs-comment">-- | /O(n)/ 'takeEnd' @n@ @t@ returns the suffix remaining after</span><span>
</span><span id="line-1168"></span><span class="hs-comment">-- taking @n@ characters from the end of @t@.</span><span>
</span><span id="line-1169"></span><span class="hs-comment">--</span><span>
</span><span id="line-1170"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1171"></span><span class="hs-comment">--</span><span>
</span><span id="line-1172"></span><span class="hs-comment">-- &gt;&gt;&gt; takeEnd 3 &quot;foobar&quot;</span><span>
</span><span id="line-1173"></span><span class="hs-comment">-- &quot;bar&quot;</span><span>
</span><span id="line-1174"></span><span class="hs-comment">--</span><span>
</span><span id="line-1175"></span><span class="hs-comment">-- @since 1.1.1.0</span><span>
</span><span id="line-1176"></span><span class="annot"><a href="Data.Text.html#takeEnd"><span class="hs-identifier hs-type">takeEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1177"></span><span id="takeEnd"><span class="annot"><span class="annottext">takeEnd :: Int -&gt; Text -&gt; Text
</span><a href="Data.Text.html#takeEnd"><span class="hs-identifier hs-var hs-var">takeEnd</span></a></span></span><span> </span><span id="local-6989586621679110213"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110213"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110212"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110212"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110211"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110211"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110210"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110210"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110209"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110209"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1178"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110213"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1179"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110213"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110209"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110212"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1180"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110211"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110210"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110208"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110209"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110208"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1181"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110208"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679110208"><span class="hs-identifier hs-var hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterNEnd"><span class="hs-identifier hs-var">iterNEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110213"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110212"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1182"></span><span>
</span><span id="line-1183"></span><span class="annot"><a href="Data.Text.html#iterNEnd"><span class="hs-identifier hs-type">iterNEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1184"></span><span id="iterNEnd"><span class="annot"><span class="annottext">iterNEnd :: Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterNEnd"><span class="hs-identifier hs-var hs-var">iterNEnd</span></a></span></span><span> </span><span id="local-6989586621679110206"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110206"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110205"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110205"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110204"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110204"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679110203"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110203"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679110202"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110202"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110201"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110202"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110206"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1185"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110201"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110201"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621679110200"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110200"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110199"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110199"><span class="hs-identifier hs-var">m</span></a></span></span><span>
</span><span id="line-1186"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110199"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110200"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1187"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110200"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1188"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
</span><a href="#local-6989586621679110201"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110200"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110198"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110199"><span class="hs-identifier hs-var">m</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1189"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110198"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679110198"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Int
</span><a href="Data.Text.Unsafe.html#reverseIter_"><span class="hs-identifier hs-var">reverseIter_</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110205"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110200"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1190"></span><span>
</span><span id="line-1191"></span><span class="hs-comment">-- | /O(n)/ 'drop' @n@, applied to a 'Text', returns the suffix of the</span><span>
</span><span id="line-1192"></span><span class="hs-comment">-- 'Text' after the first @n@ characters, or the empty 'Text' if @n@</span><span>
</span><span id="line-1193"></span><span class="hs-comment">-- is greater than the length of the 'Text'. Subject to fusion.</span><span>
</span><span id="line-1194"></span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-identifier hs-type">drop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1195"></span><span id="drop"><span class="annot"><span class="annottext">drop :: Int -&gt; Text -&gt; Text
</span><a href="Data.Text.html#drop"><span class="hs-identifier hs-var hs-var">drop</span></a></span></span><span> </span><span id="local-6989586621679110197"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110197"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110196"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110196"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110195"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110195"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110194"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110194"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110193"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110193"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1196"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110197"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110196"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1197"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110197"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110193"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1198"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110195"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110194"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110192"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110193"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110192"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1199"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110192"><span class="annot"><span class="annottext">i :: Int
</span><a href="#local-6989586621679110192"><span class="hs-identifier hs-var hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterN"><span class="hs-identifier hs-var">iterN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110197"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110196"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1200"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-pragma hs-type">drop</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1201"></span><span>
</span><span id="line-1202"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1203"></span><span class="annot"><span class="hs-pragma">&quot;TEXT drop -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110191"><span class="annot"><a href="#local-6989586621679110191"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110190"><span class="annot"><a href="#local-6989586621679110190"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1204"></span><span>    </span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-pragma hs-type">drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110191"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110190"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#drop"><span class="hs-pragma hs-type">S.drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110191"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110190"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-1205"></span><span class="annot"><span class="hs-pragma">&quot;TEXT drop -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110188"><span class="annot"><a href="#local-6989586621679110188"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110187"><span class="annot"><a href="#local-6989586621679110187"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1206"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#drop"><span class="hs-pragma hs-type">S.drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110188"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110187"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-pragma hs-type">drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110188"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110187"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1207"></span><span class="annot"><span class="hs-pragma">&quot;TEXT take . drop -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110186"><span class="annot"><a href="#local-6989586621679110186"><span class="hs-pragma hs-var">len</span></a></span></span><span> </span><span id="local-6989586621679110185"><span class="annot"><a href="#local-6989586621679110185"><span class="hs-pragma hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110184"><span class="annot"><a href="#local-6989586621679110184"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1208"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#take"><span class="hs-pragma hs-type">S.take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110186"><span class="hs-pragma hs-type">len</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#drop"><span class="hs-pragma hs-type">S.drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110185"><span class="hs-pragma hs-type">off</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110184"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#take"><span class="hs-pragma hs-type">take</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110186"><span class="hs-pragma hs-type">len</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.html#drop"><span class="hs-pragma hs-type">drop</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110185"><span class="hs-pragma hs-type">off</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110184"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1209"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1210"></span><span>
</span><span id="line-1211"></span><span class="hs-comment">-- | /O(n)/ 'dropEnd' @n@ @t@ returns the prefix remaining after</span><span>
</span><span id="line-1212"></span><span class="hs-comment">-- dropping @n@ characters from the end of @t@.</span><span>
</span><span id="line-1213"></span><span class="hs-comment">--</span><span>
</span><span id="line-1214"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1215"></span><span class="hs-comment">--</span><span>
</span><span id="line-1216"></span><span class="hs-comment">-- &gt;&gt;&gt; dropEnd 3 &quot;foobar&quot;</span><span>
</span><span id="line-1217"></span><span class="hs-comment">-- &quot;foo&quot;</span><span>
</span><span id="line-1218"></span><span class="hs-comment">--</span><span>
</span><span id="line-1219"></span><span class="hs-comment">-- @since 1.1.1.0</span><span>
</span><span id="line-1220"></span><span class="annot"><a href="Data.Text.html#dropEnd"><span class="hs-identifier hs-type">dropEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1221"></span><span id="dropEnd"><span class="annot"><span class="annottext">dropEnd :: Int -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropEnd"><span class="hs-identifier hs-var hs-var">dropEnd</span></a></span></span><span> </span><span id="local-6989586621679110183"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110183"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110182"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110182"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110181"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110181"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110180"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110180"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110179"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110179"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1222"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110183"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110182"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1223"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110183"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110179"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1224"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110181"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110180"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterNEnd"><span class="hs-identifier hs-var">iterNEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110183"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110182"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1225"></span><span>
</span><span id="line-1226"></span><span class="hs-comment">-- | /O(n)/ 'takeWhile', applied to a predicate @p@ and a 'Text',</span><span>
</span><span id="line-1227"></span><span class="hs-comment">-- returns the longest prefix (possibly empty) of elements that</span><span>
</span><span id="line-1228"></span><span class="hs-comment">-- satisfy @p@.  Subject to fusion.</span><span>
</span><span id="line-1229"></span><span class="annot"><a href="Data.Text.html#takeWhile"><span class="hs-identifier hs-type">takeWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1230"></span><span id="takeWhile"><span class="annot"><span class="annottext">takeWhile :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#takeWhile"><span class="hs-identifier hs-var hs-var">takeWhile</span></a></span></span><span> </span><span id="local-6989586621679110178"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110178"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110177"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110177"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110176"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110176"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110175"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110175"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110174"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110174"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text
</span><a href="#local-6989586621679110173"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1231"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110173"><span class="annot"><span class="annottext">loop :: Int -&gt; Text
</span><a href="#local-6989586621679110173"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110172"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110172"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110172"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110174"><span class="hs-identifier hs-var">len</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110177"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1232"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110178"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110171"><span class="hs-identifier hs-var">c</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text
</span><a href="#local-6989586621679110173"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110172"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110170"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1233"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110176"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110175"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110172"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1234"></span><span>            </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110171"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110171"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110170"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110170"><span class="hs-identifier hs-var">d</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110177"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110172"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1235"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1236"></span><span>
</span><span id="line-1237"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1238"></span><span class="annot"><span class="hs-pragma">&quot;TEXT takeWhile -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110169"><span class="annot"><a href="#local-6989586621679110169"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110168"><span class="annot"><a href="#local-6989586621679110168"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1239"></span><span>    </span><span class="annot"><a href="Data.Text.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110169"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110168"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#takeWhile"><span class="hs-pragma hs-type">S.takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110169"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110168"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-1240"></span><span class="annot"><span class="hs-pragma">&quot;TEXT takeWhile -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110166"><span class="annot"><a href="#local-6989586621679110166"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110165"><span class="annot"><a href="#local-6989586621679110165"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1241"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#takeWhile"><span class="hs-pragma hs-type">S.takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110166"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110165"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#takeWhile"><span class="hs-pragma hs-type">takeWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110166"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110165"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1242"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1243"></span><span>
</span><span id="line-1244"></span><span class="hs-comment">-- | /O(n)/ 'takeWhileEnd', applied to a predicate @p@ and a 'Text',</span><span>
</span><span id="line-1245"></span><span class="hs-comment">-- returns the longest suffix (possibly empty) of elements that</span><span>
</span><span id="line-1246"></span><span class="hs-comment">-- satisfy @p@.</span><span>
</span><span id="line-1247"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1248"></span><span class="hs-comment">--</span><span>
</span><span id="line-1249"></span><span class="hs-comment">-- &gt;&gt;&gt; takeWhileEnd (=='o') &quot;foo&quot;</span><span>
</span><span id="line-1250"></span><span class="hs-comment">-- &quot;oo&quot;</span><span>
</span><span id="line-1251"></span><span class="hs-comment">--</span><span>
</span><span id="line-1252"></span><span class="hs-comment">-- @since 1.2.2.0</span><span>
</span><span id="line-1253"></span><span class="annot"><a href="Data.Text.html#takeWhileEnd"><span class="hs-identifier hs-type">takeWhileEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1254"></span><span id="takeWhileEnd"><span class="annot"><span class="annottext">takeWhileEnd :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#takeWhileEnd"><span class="hs-identifier hs-var hs-var">takeWhileEnd</span></a></span></span><span> </span><span id="local-6989586621679110164"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110164"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110163"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110163"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110162"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110162"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110161"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110161"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110160"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110160"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110159"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110160"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110160"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1255"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110159"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110159"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110158"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110158"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110157"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110157"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110157"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110163"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1256"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110164"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110156"><span class="hs-identifier hs-var">c</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110159"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110158"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110155"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110157"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110155"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1257"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110162"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110161"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110157"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110160"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110157"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1258"></span><span>            </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110156"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110156"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110155"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110155"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; (Char, Int)
</span><a href="Data.Text.Unsafe.html#reverseIter"><span class="hs-identifier hs-var">reverseIter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110163"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110158"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1259"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#takeWhileEnd"><span class="hs-pragma hs-type">takeWhileEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1260"></span><span>
</span><span id="line-1261"></span><span class="hs-comment">-- | /O(n)/ 'dropWhile' @p@ @t@ returns the suffix remaining after</span><span>
</span><span id="line-1262"></span><span class="hs-comment">-- 'takeWhile' @p@ @t@. Subject to fusion.</span><span>
</span><span id="line-1263"></span><span class="annot"><a href="Data.Text.html#dropWhile"><span class="hs-identifier hs-type">dropWhile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1264"></span><span id="dropWhile"><span class="annot"><span class="annottext">dropWhile :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhile"><span class="hs-identifier hs-var hs-var">dropWhile</span></a></span></span><span> </span><span id="local-6989586621679110154"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110154"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110153"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110153"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110152"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110152"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110151"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110151"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110150"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110150"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110149"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1265"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110149"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110149"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110148"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110148"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110147"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110147"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110147"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110150"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1266"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110154"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110146"><span class="hs-identifier hs-var">c</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110149"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110148"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110145"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110147"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110145"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1267"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110152"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110151"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110148"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110150"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110147"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1268"></span><span>            </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110146"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110146"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110145"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110145"><span class="hs-identifier hs-var">d</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110153"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110148"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1269"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#dropWhile"><span class="hs-pragma hs-type">dropWhile</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1270"></span><span>
</span><span id="line-1271"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1272"></span><span class="annot"><span class="hs-pragma">&quot;TEXT dropWhile -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110144"><span class="annot"><a href="#local-6989586621679110144"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110143"><span class="annot"><a href="#local-6989586621679110143"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1273"></span><span>    </span><span class="annot"><a href="Data.Text.html#dropWhile"><span class="hs-pragma hs-type">dropWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110144"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110143"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#dropWhile"><span class="hs-pragma hs-type">S.dropWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110144"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110143"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span>
</span><span id="line-1274"></span><span class="annot"><span class="hs-pragma">&quot;TEXT dropWhile -&gt; unfused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110141"><span class="annot"><a href="#local-6989586621679110141"><span class="hs-pragma hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110140"><span class="annot"><a href="#local-6989586621679110140"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1275"></span><span>    </span><span class="annot"><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-pragma hs-type">unstream</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#dropWhile"><span class="hs-pragma hs-type">S.dropWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110141"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110140"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#dropWhile"><span class="hs-pragma hs-type">dropWhile</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110141"><span class="hs-pragma hs-type">p</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110140"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1276"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1277"></span><span>
</span><span id="line-1278"></span><span class="hs-comment">-- | /O(n)/ 'dropWhileEnd' @p@ @t@ returns the prefix remaining after</span><span>
</span><span id="line-1279"></span><span class="hs-comment">-- dropping characters that satisfy the predicate @p@ from the end of</span><span>
</span><span id="line-1280"></span><span class="hs-comment">-- @t@.</span><span>
</span><span id="line-1281"></span><span class="hs-comment">--</span><span>
</span><span id="line-1282"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1283"></span><span class="hs-comment">--</span><span>
</span><span id="line-1284"></span><span class="hs-comment">-- &gt;&gt;&gt; dropWhileEnd (=='.') &quot;foo...&quot;</span><span>
</span><span id="line-1285"></span><span class="hs-comment">-- &quot;foo&quot;</span><span>
</span><span id="line-1286"></span><span class="annot"><a href="Data.Text.html#dropWhileEnd"><span class="hs-identifier hs-type">dropWhileEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1287"></span><span id="dropWhileEnd"><span class="annot"><span class="annottext">dropWhileEnd :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhileEnd"><span class="hs-identifier hs-var hs-var">dropWhileEnd</span></a></span></span><span> </span><span id="local-6989586621679110139"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110139"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110138"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110138"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110137"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110137"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110136"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110136"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110135"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110135"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110134"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110135"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110135"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1288"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110134"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110134"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110133"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110133"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110132"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110132"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110132"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1289"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110139"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110131"><span class="hs-identifier hs-var">c</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110134"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110133"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110130"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110132"><span class="hs-identifier hs-var">l</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110130"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1290"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110137"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110136"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110132"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1291"></span><span>            </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110131"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110131"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110130"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110130"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; (Char, Int)
</span><a href="Data.Text.Unsafe.html#reverseIter"><span class="hs-identifier hs-var">reverseIter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110138"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110133"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1292"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#dropWhileEnd"><span class="hs-pragma hs-type">dropWhileEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1293"></span><span>
</span><span id="line-1294"></span><span class="hs-comment">-- | /O(n)/ 'dropAround' @p@ @t@ returns the substring remaining after</span><span>
</span><span id="line-1295"></span><span class="hs-comment">-- dropping characters that satisfy the predicate @p@ from both the</span><span>
</span><span id="line-1296"></span><span class="hs-comment">-- beginning and end of @t@.  Subject to fusion.</span><span>
</span><span id="line-1297"></span><span class="annot"><a href="Data.Text.html#dropAround"><span class="hs-identifier hs-type">dropAround</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1298"></span><span id="dropAround"><span class="annot"><span class="annottext">dropAround :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropAround"><span class="hs-identifier hs-var hs-var">dropAround</span></a></span></span><span> </span><span id="local-6989586621679110129"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110129"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110129"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Text) -&gt; (Text -&gt; Text) -&gt; Text -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhileEnd"><span class="hs-identifier hs-var">dropWhileEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110129"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-1299"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#dropAround"><span class="hs-pragma hs-type">dropAround</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1300"></span><span>
</span><span id="line-1301"></span><span class="hs-comment">-- | /O(n)/ Remove leading white space from a string.  Equivalent to:</span><span>
</span><span id="line-1302"></span><span class="hs-comment">--</span><span>
</span><span id="line-1303"></span><span class="hs-comment">-- &gt; dropWhile isSpace</span><span>
</span><span id="line-1304"></span><span class="annot"><a href="Data.Text.html#stripStart"><span class="hs-identifier hs-type">stripStart</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1305"></span><span id="stripStart"><span class="annot"><span class="annottext">stripStart :: Text -&gt; Text
</span><a href="Data.Text.html#stripStart"><span class="hs-identifier hs-var hs-var">stripStart</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhile"><span class="hs-identifier hs-var">dropWhile</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span>
</span><span id="line-1306"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#stripStart"><span class="hs-pragma hs-type">stripStart</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1307"></span><span>
</span><span id="line-1308"></span><span class="hs-comment">-- | /O(n)/ Remove trailing white space from a string.  Equivalent to:</span><span>
</span><span id="line-1309"></span><span class="hs-comment">--</span><span>
</span><span id="line-1310"></span><span class="hs-comment">-- &gt; dropWhileEnd isSpace</span><span>
</span><span id="line-1311"></span><span class="annot"><a href="Data.Text.html#stripEnd"><span class="hs-identifier hs-type">stripEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1312"></span><span id="stripEnd"><span class="annot"><span class="annottext">stripEnd :: Text -&gt; Text
</span><a href="Data.Text.html#stripEnd"><span class="hs-identifier hs-var hs-var">stripEnd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropWhileEnd"><span class="hs-identifier hs-var">dropWhileEnd</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span>
</span><span id="line-1313"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#stripEnd"><span class="hs-pragma hs-type">stripEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1314"></span><span>
</span><span id="line-1315"></span><span class="hs-comment">-- | /O(n)/ Remove leading and trailing white space from a string.</span><span>
</span><span id="line-1316"></span><span class="hs-comment">-- Equivalent to:</span><span>
</span><span id="line-1317"></span><span class="hs-comment">--</span><span>
</span><span id="line-1318"></span><span class="hs-comment">-- &gt; dropAround isSpace</span><span>
</span><span id="line-1319"></span><span class="annot"><a href="Data.Text.html#strip"><span class="hs-identifier hs-type">strip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1320"></span><span id="strip"><span class="annot"><span class="annottext">strip :: Text -&gt; Text
</span><a href="Data.Text.html#strip"><span class="hs-identifier hs-var hs-var">strip</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#dropAround"><span class="hs-identifier hs-var">dropAround</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span>
</span><span id="line-1321"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#strip"><span class="hs-pragma hs-type">strip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1322"></span><span>
</span><span id="line-1323"></span><span class="hs-comment">-- | /O(n)/ 'splitAt' @n t@ returns a pair whose first element is a</span><span>
</span><span id="line-1324"></span><span class="hs-comment">-- prefix of @t@ of length @n@, and whose second is the remainder of</span><span>
</span><span id="line-1325"></span><span class="hs-comment">-- the string. It is equivalent to @('take' n t, 'drop' n t)@.</span><span>
</span><span id="line-1326"></span><span class="annot"><a href="Data.Text.html#splitAt"><span class="hs-identifier hs-type">splitAt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1327"></span><span id="splitAt"><span class="annot"><span class="annottext">splitAt :: Int -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#splitAt"><span class="hs-identifier hs-var hs-var">splitAt</span></a></span></span><span> </span><span id="local-6989586621679110128"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110128"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679110127"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110127"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110126"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110126"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110125"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110125"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110124"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110124"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1328"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110128"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110127"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1329"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110128"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110124"><span class="hs-identifier hs-var">len</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110127"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1330"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679110123"><span class="annot"><span class="annottext">k :: Int
</span><a href="#local-6989586621679110123"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; Int
</span><a href="Data.Text.html#iterN"><span class="hs-identifier hs-var">iterN</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110128"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110127"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1331"></span><span>                  </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110126"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110125"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110123"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110126"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110125"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110123"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110124"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110123"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1332"></span><span>
</span><span id="line-1333"></span><span class="hs-comment">-- | /O(n)/ 'span', applied to a predicate @p@ and text @t@, returns</span><span>
</span><span id="line-1334"></span><span class="hs-comment">-- a pair whose first element is the longest prefix (possibly empty)</span><span>
</span><span id="line-1335"></span><span class="hs-comment">-- of @t@ of elements that satisfy @p@, and whose second is the</span><span>
</span><span id="line-1336"></span><span class="hs-comment">-- remainder of the list.</span><span>
</span><span id="line-1337"></span><span class="hs-comment">--</span><span>
</span><span id="line-1338"></span><span class="hs-comment">-- &gt;&gt;&gt; T.span (=='0') &quot;000AB&quot;</span><span>
</span><span id="line-1339"></span><span class="hs-comment">-- (&quot;000&quot;,&quot;AB&quot;)</span><span>
</span><span id="line-1340"></span><span class="annot"><a href="Data.Text.html#span"><span class="hs-identifier hs-type">span</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1341"></span><span id="span"><span class="annot"><span class="annottext">span :: (Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#span"><span class="hs-identifier hs-var hs-var">span</span></a></span></span><span> </span><span id="local-6989586621679110122"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110122"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110121"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110121"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (# Text, Text #)
</span><a href="Data.Text.Internal.Private.html#span_"><span class="hs-identifier hs-var">span_</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110122"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110121"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1342"></span><span>             </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679110120"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110120"><span class="hs-identifier hs-var">hd</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110119"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110119"><span class="hs-identifier hs-var">tl</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110120"><span class="hs-identifier hs-var">hd</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110119"><span class="hs-identifier hs-var">tl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1343"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#span"><span class="hs-pragma hs-type">span</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1344"></span><span>
</span><span id="line-1345"></span><span class="hs-comment">-- | /O(n)/ 'break' is like 'span', but the prefix returned is</span><span>
</span><span id="line-1346"></span><span class="hs-comment">-- over elements that fail the predicate @p@.</span><span>
</span><span id="line-1347"></span><span class="hs-comment">--</span><span>
</span><span id="line-1348"></span><span class="hs-comment">-- &gt;&gt;&gt; T.break (=='c') &quot;180cm&quot;</span><span>
</span><span id="line-1349"></span><span class="hs-comment">-- (&quot;180&quot;,&quot;cm&quot;)</span><span>
</span><span id="line-1350"></span><span class="annot"><a href="Data.Text.html#break"><span class="hs-identifier hs-type">break</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1351"></span><span id="break"><span class="annot"><span class="annottext">break :: (Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#break"><span class="hs-identifier hs-var hs-var">break</span></a></span></span><span> </span><span id="local-6989586621679110118"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110118"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#span"><span class="hs-identifier hs-var">span</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110118"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1352"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#break"><span class="hs-pragma hs-type">break</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1353"></span><span>
</span><span id="line-1354"></span><span class="hs-comment">-- | /O(n)/ Group characters in a string according to a predicate.</span><span>
</span><span id="line-1355"></span><span class="annot"><a href="Data.Text.html#groupBy"><span class="hs-identifier hs-type">groupBy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1356"></span><span id="groupBy"><span class="annot"><span class="annottext">groupBy :: (Char -&gt; Char -&gt; Bool) -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#groupBy"><span class="hs-identifier hs-var hs-var">groupBy</span></a></span></span><span> </span><span id="local-6989586621679110117"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
</span><a href="#local-6989586621679110117"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110116"><span class="hs-identifier hs-var">loop</span></a></span><span>
</span><span id="line-1357"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1358"></span><span>    </span><span id="local-6989586621679110116"><span class="annot"><span class="annottext">loop :: Text -&gt; [Text]
</span><a href="#local-6989586621679110116"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621679110115"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110115"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110114"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110114"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110113"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110113"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110112"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110112"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1359"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110115"><span class="hs-identifier hs-var">t</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1360"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110114"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110113"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110111"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110116"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110114"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110113"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110111"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110112"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110111"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1361"></span><span>        </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110110"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110110"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110109"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110109"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110115"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1362"></span><span>              </span><span id="local-6989586621679110111"><span class="annot"><span class="annottext">n :: Int
</span><a href="#local-6989586621679110111"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110109"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Int
</span><a href="Data.Text.html#findAIndexOrEnd"><span class="hs-identifier hs-var">findAIndexOrEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
</span><a href="#local-6989586621679110117"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110110"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110114"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110113"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110109"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110112"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110109"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1363"></span><span>
</span><span id="line-1364"></span><span class="hs-comment">-- | Returns the /array/ index (in units of 'Word16') at which a</span><span>
</span><span id="line-1365"></span><span class="hs-comment">-- character may be found.  This is /not/ the same as the logical</span><span>
</span><span id="line-1366"></span><span class="hs-comment">-- index returned by e.g. 'findIndex'.</span><span>
</span><span id="line-1367"></span><span class="annot"><a href="Data.Text.html#findAIndexOrEnd"><span class="hs-identifier hs-type">findAIndexOrEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1368"></span><span id="findAIndexOrEnd"><span class="annot"><span class="annottext">findAIndexOrEnd :: (Char -&gt; Bool) -&gt; Text -&gt; Int
</span><a href="Data.Text.html#findAIndexOrEnd"><span class="hs-identifier hs-var hs-var">findAIndexOrEnd</span></a></span></span><span> </span><span id="local-6989586621679110107"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110107"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span id="local-6989586621679110106"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110106"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110105"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110105"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679110104"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110104"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679110103"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110103"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679110102"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1369"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110102"><span class="annot"><span class="annottext">go :: Int -&gt; Int
</span><a href="#local-6989586621679110102"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110101"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110101"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110101"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110103"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%7C%7C"><span class="hs-operator hs-var">||</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110107"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110100"><span class="hs-identifier hs-var">c</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110101"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1370"></span><span>                </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int
</span><a href="#local-6989586621679110102"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110101"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110099"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1371"></span><span>                </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110100"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110100"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110099"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110099"><span class="hs-identifier hs-var">d</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110106"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110101"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1372"></span><span>
</span><span id="line-1373"></span><span class="hs-comment">-- | /O(n)/ Group characters in a string by equality.</span><span>
</span><span id="line-1374"></span><span class="annot"><a href="Data.Text.html#group"><span class="hs-identifier hs-type">group</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1375"></span><span id="group"><span class="annot"><span class="annottext">group :: Text -&gt; [Text]
</span><a href="Data.Text.html#group"><span class="hs-identifier hs-var hs-var">group</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Bool) -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#groupBy"><span class="hs-identifier hs-var">groupBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">(==)</span></a></span><span>
</span><span id="line-1376"></span><span>
</span><span id="line-1377"></span><span class="hs-comment">-- | /O(n)/ Return all initial segments of the given 'Text', shortest</span><span>
</span><span id="line-1378"></span><span class="hs-comment">-- first.</span><span>
</span><span id="line-1379"></span><span class="annot"><a href="Data.Text.html#inits"><span class="hs-identifier hs-type">inits</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1380"></span><span id="inits"><span class="annot"><span class="annottext">inits :: Text -&gt; [Text]
</span><a href="Data.Text.html#inits"><span class="hs-identifier hs-var hs-var">inits</span></a></span></span><span> </span><span id="local-6989586621679110098"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110098"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110097"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110097"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110096"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110096"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110095"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110095"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Text]
</span><a href="#local-6989586621679110094"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1381"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110094"><span class="annot"><span class="annottext">loop :: Int -&gt; [Text]
</span><a href="#local-6989586621679110094"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621679110093"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110093"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110093"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110095"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110098"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1382"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110097"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110096"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110093"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Text]
</span><a href="#local-6989586621679110094"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110093"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Int
</span><a href="Data.Text.Unsafe.html#iter_"><span class="hs-identifier hs-var">iter_</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110098"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110093"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1383"></span><span>
</span><span id="line-1384"></span><span class="hs-comment">-- | /O(n)/ Return all final segments of the given 'Text', longest</span><span>
</span><span id="line-1385"></span><span class="hs-comment">-- first.</span><span>
</span><span id="line-1386"></span><span class="annot"><a href="Data.Text.html#tails"><span class="hs-identifier hs-type">tails</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1387"></span><span id="tails"><span class="annot"><span class="annottext">tails :: Text -&gt; [Text]
</span><a href="Data.Text.html#tails"><span class="hs-identifier hs-var hs-var">tails</span></a></span></span><span> </span><span id="local-6989586621679110092"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110092"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110092"><span class="hs-identifier hs-var">t</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1388"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110092"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="Data.Text.html#tails"><span class="hs-identifier hs-var">tails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110092"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1389"></span><span>
</span><span id="line-1390"></span><span class="hs-comment">-- $split</span><span>
</span><span id="line-1391"></span><span class="hs-comment">--</span><span>
</span><span id="line-1392"></span><span class="hs-comment">-- Splitting functions in this library do not perform character-wise</span><span>
</span><span id="line-1393"></span><span class="hs-comment">-- copies to create substrings; they just construct new 'Text's that</span><span>
</span><span id="line-1394"></span><span class="hs-comment">-- are slices of the original.</span><span>
</span><span id="line-1395"></span><span>
</span><span id="line-1396"></span><span class="hs-comment">-- | /O(m+n)/ Break a 'Text' into pieces separated by the first 'Text'</span><span>
</span><span id="line-1397"></span><span class="hs-comment">-- argument (which cannot be empty), consuming the delimiter. An empty</span><span>
</span><span id="line-1398"></span><span class="hs-comment">-- delimiter is invalid, and will cause an error to be raised.</span><span>
</span><span id="line-1399"></span><span class="hs-comment">--</span><span>
</span><span id="line-1400"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1401"></span><span class="hs-comment">--</span><span>
</span><span id="line-1402"></span><span class="hs-comment">-- &gt;&gt;&gt; splitOn &quot;\r\n&quot; &quot;a\r\nb\r\nd\r\ne&quot;</span><span>
</span><span id="line-1403"></span><span class="hs-comment">-- [&quot;a&quot;,&quot;b&quot;,&quot;d&quot;,&quot;e&quot;]</span><span>
</span><span id="line-1404"></span><span class="hs-comment">--</span><span>
</span><span id="line-1405"></span><span class="hs-comment">-- &gt;&gt;&gt; splitOn &quot;aaa&quot;  &quot;aaaXaaaXaaaXaaa&quot;</span><span>
</span><span id="line-1406"></span><span class="hs-comment">-- [&quot;&quot;,&quot;X&quot;,&quot;X&quot;,&quot;X&quot;,&quot;&quot;]</span><span>
</span><span id="line-1407"></span><span class="hs-comment">--</span><span>
</span><span id="line-1408"></span><span class="hs-comment">-- &gt;&gt;&gt; splitOn &quot;x&quot;    &quot;x&quot;</span><span>
</span><span id="line-1409"></span><span class="hs-comment">-- [&quot;&quot;,&quot;&quot;]</span><span>
</span><span id="line-1410"></span><span class="hs-comment">--</span><span>
</span><span id="line-1411"></span><span class="hs-comment">-- and</span><span>
</span><span id="line-1412"></span><span class="hs-comment">--</span><span>
</span><span id="line-1413"></span><span class="hs-comment">-- &gt; intercalate s . splitOn s         == id</span><span>
</span><span id="line-1414"></span><span class="hs-comment">-- &gt; splitOn (singleton c)             == split (==c)</span><span>
</span><span id="line-1415"></span><span class="hs-comment">--</span><span>
</span><span id="line-1416"></span><span class="hs-comment">-- (Note: the string @s@ to split on above cannot be empty.)</span><span>
</span><span id="line-1417"></span><span class="hs-comment">--</span><span>
</span><span id="line-1418"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-1419"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-1420"></span><span class="annot"><a href="Data.Text.html#splitOn"><span class="hs-identifier hs-type">splitOn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1421"></span><span>        </span><span class="hs-comment">-- ^ String to split on. If this string is empty, an error</span><span>
</span><span id="line-1422"></span><span>        </span><span class="hs-comment">-- will occur.</span><span>
</span><span id="line-1423"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1424"></span><span>        </span><span class="hs-comment">-- ^ Input text.</span><span>
</span><span id="line-1425"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1426"></span><span id="splitOn"><span class="annot"><span class="annottext">splitOn :: Text -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#splitOn"><span class="hs-identifier hs-var hs-var">splitOn</span></a></span></span><span> </span><span id="local-6989586621679110091"><span class="annot"><span class="annottext">pat :: Text
</span><a href="#local-6989586621679110091"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679110090"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110090"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679110089"><span class="annot"><span class="annottext">src :: Text
</span><a href="#local-6989586621679110089"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110088"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110088"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110087"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110087"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110086"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110086"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1427"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110090"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Text]
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;splitOn&quot;</span></span><span>
</span><span id="line-1428"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110091"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110091"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110089"><span class="hs-identifier hs-var">src</span></a></span><span>
</span><span id="line-1429"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Int] -&gt; [Text]
</span><a href="#local-6989586621679110085"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110091"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110089"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1430"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1431"></span><span>    </span><span id="local-6989586621679110085"><span class="annot"><span class="annottext">go :: Int -&gt; [Int] -&gt; [Text]
</span><a href="#local-6989586621679110085"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110084"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110084"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110083"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110083"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679110082"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110082"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110088"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110084"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110087"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110083"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110084"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Int] -&gt; [Text]
</span><a href="#local-6989586621679110085"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110083"><span class="hs-identifier hs-var">x</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110090"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679110082"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1432"></span><span>    </span><span class="annot"><a href="#local-6989586621679110085"><span class="hs-identifier hs-var">go</span></a></span><span>  </span><span id="local-6989586621679110081"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110081"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110088"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110081"><span class="hs-identifier hs-var">s</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110087"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110086"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110081"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1433"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#splitOn"><span class="hs-pragma hs-type">splitOn</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1434"></span><span>
</span><span id="line-1435"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1436"></span><span class="annot"><span class="hs-pragma">&quot;TEXT splitOn/singleton -&gt; split/==&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110080"><span class="annot"><a href="#local-6989586621679110080"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110079"><span class="annot"><a href="#local-6989586621679110079"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1437"></span><span>    </span><span class="annot"><a href="Data.Text.html#splitOn"><span class="hs-pragma hs-type">splitOn</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110080"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110079"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#split"><span class="hs-pragma hs-type">split</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-pragma hs-type">==</span></a></span><span class="annot"><a href="#local-6989586621679110080"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110079"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1438"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1439"></span><span>
</span><span id="line-1440"></span><span class="hs-comment">-- | /O(n)/ Splits a 'Text' into components delimited by separators,</span><span>
</span><span id="line-1441"></span><span class="hs-comment">-- where the predicate returns True for a separator element.  The</span><span>
</span><span id="line-1442"></span><span class="hs-comment">-- resulting components do not contain the separators.  Two adjacent</span><span>
</span><span id="line-1443"></span><span class="hs-comment">-- separators result in an empty component in the output.  eg.</span><span>
</span><span id="line-1444"></span><span class="hs-comment">--</span><span>
</span><span id="line-1445"></span><span class="hs-comment">-- &gt;&gt;&gt; split (=='a') &quot;aabbaca&quot;</span><span>
</span><span id="line-1446"></span><span class="hs-comment">-- [&quot;&quot;,&quot;&quot;,&quot;bb&quot;,&quot;c&quot;,&quot;&quot;]</span><span>
</span><span id="line-1447"></span><span class="hs-comment">--</span><span>
</span><span id="line-1448"></span><span class="hs-comment">-- &gt;&gt;&gt; split (=='a') &quot;&quot;</span><span>
</span><span id="line-1449"></span><span class="hs-comment">-- [&quot;&quot;]</span><span>
</span><span id="line-1450"></span><span class="annot"><a href="Data.Text.html#split"><span class="hs-identifier hs-type">split</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1451"></span><span id="split"><span class="annot"><span class="annottext">split :: (Char -&gt; Bool) -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#split"><span class="hs-identifier hs-var hs-var">split</span></a></span></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679110078"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110078"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110077"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110077"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679110076"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110076"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110078"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1452"></span><span class="annot"><a href="Data.Text.html#split"><span class="hs-identifier hs-var">split</span></a></span><span> </span><span id="local-6989586621679110075"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110075"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110074"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110074"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110073"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110074"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1453"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110073"><span class="annot"><span class="annottext">loop :: Text -&gt; [Text]
</span><a href="#local-6989586621679110073"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span id="local-6989586621679110072"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110072"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110071"><span class="hs-identifier hs-var">s'</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110070"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1454"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110070"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110073"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110071"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1455"></span><span>              </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679110070"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110070"><span class="hs-identifier hs-var">l</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679110071"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110071"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (# Text, Text #)
</span><a href="Data.Text.Internal.Private.html#span_"><span class="hs-identifier hs-var">span_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110075"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110072"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1456"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#split"><span class="hs-pragma hs-type">split</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1457"></span><span>
</span><span id="line-1458"></span><span class="hs-comment">-- | /O(n)/ Splits a 'Text' into components of length @k@.  The last</span><span>
</span><span id="line-1459"></span><span class="hs-comment">-- element may be shorter than the other chunks, depending on the</span><span>
</span><span id="line-1460"></span><span class="hs-comment">-- length of the input. Examples:</span><span>
</span><span id="line-1461"></span><span class="hs-comment">--</span><span>
</span><span id="line-1462"></span><span class="hs-comment">-- &gt;&gt;&gt; chunksOf 3 &quot;foobarbaz&quot;</span><span>
</span><span id="line-1463"></span><span class="hs-comment">-- [&quot;foo&quot;,&quot;bar&quot;,&quot;baz&quot;]</span><span>
</span><span id="line-1464"></span><span class="hs-comment">--</span><span>
</span><span id="line-1465"></span><span class="hs-comment">-- &gt;&gt;&gt; chunksOf 4 &quot;haskell.org&quot;</span><span>
</span><span id="line-1466"></span><span class="hs-comment">-- [&quot;hask&quot;,&quot;ell.&quot;,&quot;org&quot;]</span><span>
</span><span id="line-1467"></span><span class="annot"><a href="Data.Text.html#chunksOf"><span class="hs-identifier hs-type">chunksOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1468"></span><span id="chunksOf"><span class="annot"><span class="annottext">chunksOf :: Int -&gt; Text -&gt; [Text]
</span><a href="Data.Text.html#chunksOf"><span class="hs-identifier hs-var hs-var">chunksOf</span></a></span></span><span> </span><span id="local-6989586621679110069"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110069"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110068"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-1469"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1470"></span><span>    </span><span id="local-6989586621679110068"><span class="annot"><span class="annottext">go :: Text -&gt; [Text]
</span><a href="#local-6989586621679110068"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621679110067"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110067"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#splitAt"><span class="hs-identifier hs-var">splitAt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110069"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110067"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1471"></span><span>             </span><span class="hs-special">(</span><span id="local-6989586621679110066"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110066"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110065"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110065"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110066"><span class="hs-identifier hs-var">a</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1472"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110066"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="#local-6989586621679110068"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110065"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1473"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#chunksOf"><span class="hs-pragma hs-type">chunksOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1474"></span><span>
</span><span id="line-1475"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-1476"></span><span class="hs-comment">-- * Searching</span><span>
</span><span id="line-1477"></span><span>
</span><span id="line-1478"></span><span class="hs-comment">-------------------------------------------------------------------------------</span><span>
</span><span id="line-1479"></span><span class="hs-comment">-- ** Searching with a predicate</span><span>
</span><span id="line-1480"></span><span>
</span><span id="line-1481"></span><span class="hs-comment">-- | /O(n)/ The 'elem' function takes a character and a 'Text', and</span><span>
</span><span id="line-1482"></span><span class="hs-comment">-- returns 'True' if the element is found in the given 'Text', or</span><span>
</span><span id="line-1483"></span><span class="hs-comment">-- 'False' otherwise.</span><span>
</span><span id="line-1484"></span><span class="annot"><a href="Data.Text.html#elem"><span class="hs-identifier hs-type">elem</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1485"></span><span id="elem"><span class="annot"><span class="annottext">elem :: Char -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#elem"><span class="hs-identifier hs-var hs-var">elem</span></a></span></span><span> </span><span id="local-6989586621679110064"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110064"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110063"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110063"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#any"><span class="hs-identifier hs-var">S.any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110064"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110063"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1486"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#elem"><span class="hs-pragma hs-type">elem</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1487"></span><span>
</span><span id="line-1488"></span><span class="hs-comment">-- | /O(n)/ The 'find' function takes a predicate and a 'Text', and</span><span>
</span><span id="line-1489"></span><span class="hs-comment">-- returns the first element matching the predicate, or 'Nothing' if</span><span>
</span><span id="line-1490"></span><span class="hs-comment">-- there is no such element. Subject to fusion.</span><span>
</span><span id="line-1491"></span><span class="annot"><a href="Data.Text.html#find"><span class="hs-identifier hs-type">find</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-1492"></span><span id="find"><span class="annot"><span class="annottext">find :: (Char -&gt; Bool) -&gt; Text -&gt; Maybe Char
</span><a href="Data.Text.html#find"><span class="hs-identifier hs-var hs-var">find</span></a></span></span><span> </span><span id="local-6989586621679110062"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110062"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110061"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110061"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Maybe Char
</span><a href="Data.Text.Internal.Fusion.Common.html#findBy"><span class="hs-identifier hs-var">S.findBy</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110062"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110061"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1493"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#find"><span class="hs-pragma hs-type">find</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1494"></span><span>
</span><span id="line-1495"></span><span class="hs-comment">-- | /O(n)/ The 'partition' function takes a predicate and a 'Text',</span><span>
</span><span id="line-1496"></span><span class="hs-comment">-- and returns the pair of 'Text's with elements which do and do not</span><span>
</span><span id="line-1497"></span><span class="hs-comment">-- satisfy the predicate, respectively; i.e.</span><span>
</span><span id="line-1498"></span><span class="hs-comment">--</span><span>
</span><span id="line-1499"></span><span class="hs-comment">-- &gt; partition p t == (filter p t, filter (not . p) t)</span><span>
</span><span id="line-1500"></span><span class="annot"><a href="Data.Text.html#partition"><span class="hs-identifier hs-type">partition</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1501"></span><span id="partition"><span class="annot"><span class="annottext">partition :: (Char -&gt; Bool) -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#partition"><span class="hs-identifier hs-var hs-var">partition</span></a></span></span><span> </span><span id="local-6989586621679110059"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110059"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110058"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110058"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110059"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110058"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Char -&gt; Bool) -&gt; Char -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110059"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110058"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1502"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#partition"><span class="hs-pragma hs-type">partition</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1503"></span><span>
</span><span id="line-1504"></span><span class="hs-comment">-- | /O(n)/ 'filter', applied to a predicate and a 'Text',</span><span>
</span><span id="line-1505"></span><span class="hs-comment">-- returns a 'Text' containing those characters that satisfy the</span><span>
</span><span id="line-1506"></span><span class="hs-comment">-- predicate.</span><span>
</span><span id="line-1507"></span><span class="annot"><a href="Data.Text.html#filter"><span class="hs-identifier hs-type">filter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1508"></span><span id="filter"><span class="annot"><span class="annottext">filter :: (Char -&gt; Bool) -&gt; Text -&gt; Text
</span><a href="Data.Text.html#filter"><span class="hs-identifier hs-var hs-var">filter</span></a></span></span><span> </span><span id="local-6989586621679110057"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110057"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110056"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110056"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.Common.html#filter"><span class="hs-identifier hs-var">S.filter</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110057"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110056"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1509"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#filter"><span class="hs-pragma hs-type">filter</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1510"></span><span>
</span><span id="line-1511"></span><span class="hs-comment">-- | /O(n+m)/ Find the first instance of @needle@ (which must be</span><span>
</span><span id="line-1512"></span><span class="hs-comment">-- non-'null') in @haystack@.  The first element of the returned tuple</span><span>
</span><span id="line-1513"></span><span class="hs-comment">-- is the prefix of @haystack@ before @needle@ is matched.  The second</span><span>
</span><span id="line-1514"></span><span class="hs-comment">-- is the remainder of @haystack@, starting with the match.</span><span>
</span><span id="line-1515"></span><span class="hs-comment">--</span><span>
</span><span id="line-1516"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1517"></span><span class="hs-comment">--</span><span>
</span><span id="line-1518"></span><span class="hs-comment">-- &gt;&gt;&gt; breakOn &quot;::&quot; &quot;a::b::c&quot;</span><span>
</span><span id="line-1519"></span><span class="hs-comment">-- (&quot;a&quot;,&quot;::b::c&quot;)</span><span>
</span><span id="line-1520"></span><span class="hs-comment">--</span><span>
</span><span id="line-1521"></span><span class="hs-comment">-- &gt;&gt;&gt; breakOn &quot;/&quot; &quot;foobar&quot;</span><span>
</span><span id="line-1522"></span><span class="hs-comment">-- (&quot;foobar&quot;,&quot;&quot;)</span><span>
</span><span id="line-1523"></span><span class="hs-comment">--</span><span>
</span><span id="line-1524"></span><span class="hs-comment">-- Laws:</span><span>
</span><span id="line-1525"></span><span class="hs-comment">--</span><span>
</span><span id="line-1526"></span><span class="hs-comment">-- &gt; append prefix match == haystack</span><span>
</span><span id="line-1527"></span><span class="hs-comment">-- &gt;   where (prefix, match) = breakOn needle haystack</span><span>
</span><span id="line-1528"></span><span class="hs-comment">--</span><span>
</span><span id="line-1529"></span><span class="hs-comment">-- If you need to break a string by a substring repeatedly (e.g. you</span><span>
</span><span id="line-1530"></span><span class="hs-comment">-- want to break on every instance of a substring), use 'breakOnAll'</span><span>
</span><span id="line-1531"></span><span class="hs-comment">-- instead, as it has lower startup overhead.</span><span>
</span><span id="line-1532"></span><span class="hs-comment">--</span><span>
</span><span id="line-1533"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-1534"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-1535"></span><span class="annot"><a href="Data.Text.html#breakOn"><span class="hs-identifier hs-type">breakOn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1536"></span><span id="breakOn"><span class="annot"><span class="annottext">breakOn :: Text -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#breakOn"><span class="hs-identifier hs-var hs-var">breakOn</span></a></span></span><span> </span><span id="local-6989586621679110054"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110054"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621679110053"><span class="annot"><span class="annottext">src :: Text
</span><a href="#local-6989586621679110053"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110052"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110052"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110051"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110051"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110050"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110050"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1537"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110054"><span class="hs-identifier hs-var">pat</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (Text, Text)
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;breakOn&quot;</span></span><span>
</span><span id="line-1538"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110054"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110053"><span class="hs-identifier hs-var">src</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1539"></span><span>                    </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110053"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="Data.Text.Internal.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1540"></span><span>                    </span><span class="hs-special">(</span><span id="local-6989586621679110049"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110049"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110052"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110051"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110049"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110052"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110051"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110049"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110050"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110049"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1541"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#breakOn"><span class="hs-pragma hs-type">breakOn</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1542"></span><span>
</span><span id="line-1543"></span><span class="hs-comment">-- | /O(n+m)/ Similar to 'breakOn', but searches from the end of the</span><span>
</span><span id="line-1544"></span><span class="hs-comment">-- string.</span><span>
</span><span id="line-1545"></span><span class="hs-comment">--</span><span>
</span><span id="line-1546"></span><span class="hs-comment">-- The first element of the returned tuple is the prefix of @haystack@</span><span>
</span><span id="line-1547"></span><span class="hs-comment">-- up to and including the last match of @needle@.  The second is the</span><span>
</span><span id="line-1548"></span><span class="hs-comment">-- remainder of @haystack@, following the match.</span><span>
</span><span id="line-1549"></span><span class="hs-comment">--</span><span>
</span><span id="line-1550"></span><span class="hs-comment">-- &gt;&gt;&gt; breakOnEnd &quot;::&quot; &quot;a::b::c&quot;</span><span>
</span><span id="line-1551"></span><span class="hs-comment">-- (&quot;a::b::&quot;,&quot;c&quot;)</span><span>
</span><span id="line-1552"></span><span class="annot"><a href="Data.Text.html#breakOnEnd"><span class="hs-identifier hs-type">breakOnEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1553"></span><span id="breakOnEnd"><span class="annot"><span class="annottext">breakOnEnd :: Text -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#breakOnEnd"><span class="hs-identifier hs-var hs-var">breakOnEnd</span></a></span></span><span> </span><span id="local-6989586621679110048"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110048"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621679110047"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110047"><span class="hs-identifier hs-var">src</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110046"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110045"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1554"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679110045"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110045"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679110046"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110046"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; (Text, Text)
</span><a href="Data.Text.html#breakOn"><span class="hs-identifier hs-var">breakOn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110048"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110047"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1555"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#breakOnEnd"><span class="hs-pragma hs-type">breakOnEnd</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1556"></span><span>
</span><span id="line-1557"></span><span class="hs-comment">-- | /O(n+m)/ Find all non-overlapping instances of @needle@ in</span><span>
</span><span id="line-1558"></span><span class="hs-comment">-- @haystack@.  Each element of the returned list consists of a pair:</span><span>
</span><span id="line-1559"></span><span class="hs-comment">--</span><span>
</span><span id="line-1560"></span><span class="hs-comment">-- * The entire string prior to the /k/th match (i.e. the prefix)</span><span>
</span><span id="line-1561"></span><span class="hs-comment">--</span><span>
</span><span id="line-1562"></span><span class="hs-comment">-- * The /k/th match, followed by the remainder of the string</span><span>
</span><span id="line-1563"></span><span class="hs-comment">--</span><span>
</span><span id="line-1564"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1565"></span><span class="hs-comment">--</span><span>
</span><span id="line-1566"></span><span class="hs-comment">-- &gt;&gt;&gt; breakOnAll &quot;::&quot; &quot;&quot;</span><span>
</span><span id="line-1567"></span><span class="hs-comment">-- []</span><span>
</span><span id="line-1568"></span><span class="hs-comment">--</span><span>
</span><span id="line-1569"></span><span class="hs-comment">-- &gt;&gt;&gt; breakOnAll &quot;/&quot; &quot;a/b/c/&quot;</span><span>
</span><span id="line-1570"></span><span class="hs-comment">-- [(&quot;a&quot;,&quot;/b/c/&quot;),(&quot;a/b&quot;,&quot;/c/&quot;),(&quot;a/b/c&quot;,&quot;/&quot;)]</span><span>
</span><span id="line-1571"></span><span class="hs-comment">--</span><span>
</span><span id="line-1572"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-1573"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-1574"></span><span class="hs-comment">--</span><span>
</span><span id="line-1575"></span><span class="hs-comment">-- The @needle@ parameter may not be empty.</span><span>
</span><span id="line-1576"></span><span class="annot"><a href="Data.Text.html#breakOnAll"><span class="hs-identifier hs-type">breakOnAll</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>              </span><span class="hs-comment">-- ^ @needle@ to search for</span><span>
</span><span id="line-1577"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>              </span><span class="hs-comment">-- ^ @haystack@ in which to search</span><span>
</span><span id="line-1578"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1579"></span><span id="breakOnAll"><span class="annot"><span class="annottext">breakOnAll :: Text -&gt; Text -&gt; [(Text, Text)]
</span><a href="Data.Text.html#breakOnAll"><span class="hs-identifier hs-var hs-var">breakOnAll</span></a></span></span><span> </span><span id="local-6989586621679110044"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110044"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621679110043"><span class="annot"><span class="annottext">src :: Text
</span><a href="#local-6989586621679110043"><span class="hs-identifier hs-var">src</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110042"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110042"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110041"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110041"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110040"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110040"><span class="hs-identifier hs-var">slen</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1580"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110044"><span class="hs-identifier hs-var">pat</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [(Text, Text)]
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;breakOnAll&quot;</span></span><span>
</span><span id="line-1581"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; (Text, Text)) -&gt; [Int] -&gt; [(Text, Text)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; (Text, Text)
</span><a href="#local-6989586621679110039"><span class="hs-identifier hs-var">step</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110044"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110043"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1582"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1583"></span><span>    </span><span id="local-6989586621679110039"><span class="annot"><span class="annottext">step :: Int -&gt; (Text, Text)
</span><a href="#local-6989586621679110039"><span class="hs-identifier hs-var hs-var">step</span></a></span></span><span>       </span><span id="local-6989586621679110038"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110038"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110037"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110038"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110037"><span class="hs-identifier hs-var">chunk</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110038"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110040"><span class="hs-identifier hs-var">slen</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110038"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1584"></span><span>    </span><span id="local-6989586621679110037"><span class="annot"><span class="annottext">chunk :: Int -&gt; Int -&gt; Text
</span><a href="#local-6989586621679110037"><span class="hs-identifier hs-var hs-var">chunk</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110036"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110036"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110035"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110035"><span class="hs-identifier hs-var">l</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110042"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110036"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110041"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110035"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1585"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#breakOnAll"><span class="hs-pragma hs-type">breakOnAll</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1586"></span><span>
</span><span id="line-1587"></span><span class="hs-comment">-------------------------------------------------------------------------------</span><span>
</span><span id="line-1588"></span><span class="hs-comment">-- ** Indexing 'Text's</span><span>
</span><span id="line-1589"></span><span>
</span><span id="line-1590"></span><span class="hs-comment">-- $index</span><span>
</span><span id="line-1591"></span><span class="hs-comment">--</span><span>
</span><span id="line-1592"></span><span class="hs-comment">-- If you think of a 'Text' value as an array of 'Char' values (which</span><span>
</span><span id="line-1593"></span><span class="hs-comment">-- it is not), you run the risk of writing inefficient code.</span><span>
</span><span id="line-1594"></span><span class="hs-comment">--</span><span>
</span><span id="line-1595"></span><span class="hs-comment">-- An idiom that is common in some languages is to find the numeric</span><span>
</span><span id="line-1596"></span><span class="hs-comment">-- offset of a character or substring, then use that number to split</span><span>
</span><span id="line-1597"></span><span class="hs-comment">-- or trim the searched string.  With a 'Text' value, this approach</span><span>
</span><span id="line-1598"></span><span class="hs-comment">-- would require two /O(n)/ operations: one to perform the search, and</span><span>
</span><span id="line-1599"></span><span class="hs-comment">-- one to operate from wherever the search ended.</span><span>
</span><span id="line-1600"></span><span class="hs-comment">--</span><span>
</span><span id="line-1601"></span><span class="hs-comment">-- For example, suppose you have a string that you want to split on</span><span>
</span><span id="line-1602"></span><span class="hs-comment">-- the substring @\&quot;::\&quot;@, such as @\&quot;foo::bar::quux\&quot;@. Instead of</span><span>
</span><span id="line-1603"></span><span class="hs-comment">-- searching for the index of @\&quot;::\&quot;@ and taking the substrings</span><span>
</span><span id="line-1604"></span><span class="hs-comment">-- before and after that index, you would instead use @breakOnAll \&quot;::\&quot;@.</span><span>
</span><span id="line-1605"></span><span>
</span><span id="line-1606"></span><span class="hs-comment">-- | /O(n)/ 'Text' index (subscript) operator, starting from 0. Subject to fusion.</span><span>
</span><span id="line-1607"></span><span class="annot"><a href="Data.Text.html#index"><span class="hs-identifier hs-type">index</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span>
</span><span id="line-1608"></span><span id="index"><span class="annot"><span class="annottext">index :: Text -&gt; Int -&gt; Char
</span><a href="Data.Text.html#index"><span class="hs-identifier hs-var hs-var">index</span></a></span></span><span> </span><span id="local-6989586621679110034"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110034"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679110033"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110033"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Int -&gt; Char
</span><a href="Data.Text.Internal.Fusion.html#index"><span class="hs-identifier hs-var">S.index</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110034"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110033"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1609"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#index"><span class="hs-pragma hs-type">index</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1610"></span><span>
</span><span id="line-1611"></span><span class="hs-comment">-- | /O(n)/ The 'findIndex' function takes a predicate and a 'Text'</span><span>
</span><span id="line-1612"></span><span class="hs-comment">-- and returns the index of the first element in the 'Text' satisfying</span><span>
</span><span id="line-1613"></span><span class="hs-comment">-- the predicate. Subject to fusion.</span><span>
</span><span id="line-1614"></span><span class="annot"><a href="Data.Text.html#findIndex"><span class="hs-identifier hs-type">findIndex</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1615"></span><span id="findIndex"><span class="annot"><span class="annottext">findIndex :: (Char -&gt; Bool) -&gt; Text -&gt; Maybe Int
</span><a href="Data.Text.html#findIndex"><span class="hs-identifier hs-var hs-var">findIndex</span></a></span></span><span> </span><span id="local-6989586621679110031"><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110031"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621679110030"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110030"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Stream Char -&gt; Maybe Int
</span><a href="Data.Text.Internal.Fusion.html#findIndex"><span class="hs-identifier hs-var">S.findIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="#local-6989586621679110031"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110030"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1616"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#findIndex"><span class="hs-pragma hs-type">findIndex</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1617"></span><span>
</span><span id="line-1618"></span><span class="hs-comment">-- | /O(n+m)/ The 'count' function returns the number of times the</span><span>
</span><span id="line-1619"></span><span class="hs-comment">-- query string appears in the given 'Text'. An empty query string is</span><span>
</span><span id="line-1620"></span><span class="hs-comment">-- invalid, and will cause an error to be raised.</span><span>
</span><span id="line-1621"></span><span class="hs-comment">--</span><span>
</span><span id="line-1622"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-1623"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-1624"></span><span class="annot"><a href="Data.Text.html#count"><span class="hs-identifier hs-type">count</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1625"></span><span id="count"><span class="annot"><span class="annottext">count :: Text -&gt; Text -&gt; Int
</span><a href="Data.Text.html#count"><span class="hs-identifier hs-var hs-var">count</span></a></span></span><span> </span><span id="local-6989586621679110028"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110028"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621679110027"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110027"><span class="hs-identifier hs-var">src</span></a></span></span><span>
</span><span id="line-1626"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110028"><span class="hs-identifier hs-var">pat</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var">emptyError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;count&quot;</span></span><span>
</span><span id="line-1627"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110028"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Text -&gt; Int
</span><a href="Data.Text.html#countChar"><span class="hs-identifier hs-var">countChar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110028"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110027"><span class="hs-identifier hs-var">src</span></a></span><span>
</span><span id="line-1628"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">L.length</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110028"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110027"><span class="hs-identifier hs-var">src</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1629"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#count"><span class="hs-pragma hs-type">count</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1630"></span><span>
</span><span id="line-1631"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1632"></span><span class="annot"><span class="hs-pragma">&quot;TEXT count/singleton -&gt; countChar&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679110025"><span class="annot"><a href="#local-6989586621679110025"><span class="hs-pragma hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110024"><span class="annot"><a href="#local-6989586621679110024"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1633"></span><span>    </span><span class="annot"><a href="Data.Text.html#count"><span class="hs-pragma hs-type">count</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110025"><span class="hs-pragma hs-type">c</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679110024"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.html#countChar"><span class="hs-pragma hs-type">countChar</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110025"><span class="hs-pragma hs-type">c</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679110024"><span class="hs-pragma hs-type">t</span></a></span><span>
</span><span id="line-1634"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1635"></span><span>
</span><span id="line-1636"></span><span class="hs-comment">-- | /O(n)/ The 'countChar' function returns the number of times the</span><span>
</span><span id="line-1637"></span><span class="hs-comment">-- query element appears in the given 'Text'. Subject to fusion.</span><span>
</span><span id="line-1638"></span><span class="annot"><a href="Data.Text.html#countChar"><span class="hs-identifier hs-type">countChar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1639"></span><span id="countChar"><span class="annot"><span class="annottext">countChar :: Char -&gt; Text -&gt; Int
</span><a href="Data.Text.html#countChar"><span class="hs-identifier hs-var hs-var">countChar</span></a></span></span><span> </span><span id="local-6989586621679110023"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110023"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110022"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110022"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Stream Char -&gt; Int
</span><a href="Data.Text.Internal.Fusion.html#countChar"><span class="hs-identifier hs-var">S.countChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110023"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110022"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1640"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#countChar"><span class="hs-pragma hs-type">countChar</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1641"></span><span>
</span><span id="line-1642"></span><span class="hs-comment">-------------------------------------------------------------------------------</span><span>
</span><span id="line-1643"></span><span class="hs-comment">-- * Zipping</span><span>
</span><span id="line-1644"></span><span>
</span><span id="line-1645"></span><span class="hs-comment">-- | /O(n)/ 'zip' takes two 'Text's and returns a list of</span><span>
</span><span id="line-1646"></span><span class="hs-comment">-- corresponding pairs of bytes. If one input 'Text' is short,</span><span>
</span><span id="line-1647"></span><span class="hs-comment">-- excess elements of the longer 'Text' are discarded. This is</span><span>
</span><span id="line-1648"></span><span class="hs-comment">-- equivalent to a pair of 'unpack' operations.</span><span>
</span><span id="line-1649"></span><span class="annot"><a href="Data.Text.html#zip"><span class="hs-identifier hs-type">zip</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">,</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1650"></span><span id="zip"><span class="annot"><span class="annottext">zip :: Text -&gt; Text -&gt; [(Char, Char)]
</span><a href="Data.Text.html#zip"><span class="hs-identifier hs-var hs-var">zip</span></a></span></span><span> </span><span id="local-6989586621679110020"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110020"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110019"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110019"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream (Char, Char) -&gt; [(Char, Char)]
forall a. Stream a -&gt; [a]
</span><a href="Data.Text.Internal.Fusion.Common.html#unstreamList"><span class="hs-identifier hs-var">S.unstreamList</span></a></span><span> </span><span class="annot"><span class="annottext">(Stream (Char, Char) -&gt; [(Char, Char)])
-&gt; Stream (Char, Char) -&gt; [(Char, Char)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; (Char, Char))
-&gt; Stream Char -&gt; Stream Char -&gt; Stream (Char, Char)
forall a b. (a -&gt; a -&gt; b) -&gt; Stream a -&gt; Stream a -&gt; Stream b
</span><a href="Data.Text.Internal.Fusion.Common.html#zipWith"><span class="hs-identifier hs-var">S.zipWith</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">,</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110020"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110019"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1651"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#zip"><span class="hs-pragma hs-type">zip</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1652"></span><span>
</span><span id="line-1653"></span><span class="hs-comment">-- | /O(n)/ 'zipWith' generalises 'zip' by zipping with the function</span><span>
</span><span id="line-1654"></span><span class="hs-comment">-- given as the first argument, instead of a tupling function.</span><span>
</span><span id="line-1655"></span><span class="hs-comment">-- Performs replacement on invalid scalar values.</span><span>
</span><span id="line-1656"></span><span class="annot"><a href="Data.Text.html#zipWith"><span class="hs-identifier hs-type">zipWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1657"></span><span id="zipWith"><span class="annot"><span class="annottext">zipWith :: (Char -&gt; Char -&gt; Char) -&gt; Text -&gt; Text -&gt; Text
</span><a href="Data.Text.html#zipWith"><span class="hs-identifier hs-var hs-var">zipWith</span></a></span></span><span> </span><span id="local-6989586621679110016"><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110016"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679110015"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110015"><span class="hs-identifier hs-var">t1</span></a></span></span><span> </span><span id="local-6989586621679110014"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110014"><span class="hs-identifier hs-var">t2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Text
</span><a href="Data.Text.Internal.Fusion.html#unstream"><span class="hs-identifier hs-var">unstream</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Char -&gt; Char) -&gt; Stream Char -&gt; Stream Char -&gt; Stream Char
forall a b. (a -&gt; a -&gt; b) -&gt; Stream a -&gt; Stream a -&gt; Stream b
</span><a href="Data.Text.Internal.Fusion.Common.html#zipWith"><span class="hs-identifier hs-var">S.zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110013"><span class="hs-identifier hs-var">g</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110015"><span class="hs-identifier hs-var">t1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110014"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1658"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679110013"><span class="annot"><span class="annottext">g :: Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110013"><span class="hs-identifier hs-var hs-var">g</span></a></span></span><span> </span><span id="local-6989586621679110012"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110012"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679110011"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110011"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char
</span><a href="Data.Text.Internal.html#safe"><span class="hs-keyword hs-var">safe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Char
</span><a href="#local-6989586621679110016"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110012"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110011"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1659"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#zipWith"><span class="hs-pragma hs-type">zipWith</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1660"></span><span>
</span><span id="line-1661"></span><span class="hs-comment">-- | /O(n)/ Breaks a 'Text' up into a list of words, delimited by 'Char's</span><span>
</span><span id="line-1662"></span><span class="hs-comment">-- representing white space.</span><span>
</span><span id="line-1663"></span><span class="annot"><a href="Data.Text.html#words"><span class="hs-identifier hs-type">words</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1664"></span><span id="words"><span class="annot"><span class="annottext">words :: Text -&gt; [Text]
</span><a href="Data.Text.html#words"><span class="hs-identifier hs-var hs-var">words</span></a></span></span><span> </span><span id="local-6989586621679110010"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679110010"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679110009"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110009"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679110008"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110008"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679110007"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110007"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Text]
</span><a href="#local-6989586621679110006"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1665"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1666"></span><span>    </span><span id="local-6989586621679110006"><span class="annot"><span class="annottext">loop :: Int -&gt; Int -&gt; [Text]
</span><a href="#local-6989586621679110006"><span class="hs-identifier hs-var hs-var">loop</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110005"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679110004"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-1667"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110007"><span class="hs-identifier hs-var">len</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1668"></span><span>                     </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1669"></span><span>                     </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110009"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110008"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1670"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="../../base/src/GHC.Unicode.html#isSpace"><span class="hs-identifier hs-var">isSpace</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110003"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1671"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1672"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Text]
</span><a href="#local-6989586621679110006"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-1673"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679110009"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110008"><span class="hs-identifier hs-var">off</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Text]
</span><a href="#local-6989586621679110006"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110002"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110002"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1674"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; [Text]
</span><a href="#local-6989586621679110006"><span class="hs-identifier hs-var">loop</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110005"><span class="hs-identifier hs-var">start</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110002"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1675"></span><span>        </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679110003"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679110003"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621679110002"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110002"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110010"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679110004"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-1676"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#words"><span class="hs-pragma hs-type">words</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1677"></span><span>
</span><span id="line-1678"></span><span class="hs-comment">-- | /O(n)/ Breaks a 'Text' up into a list of 'Text's at</span><span>
</span><span id="line-1679"></span><span class="hs-comment">-- newline 'Char's. The resulting strings do not contain newlines.</span><span>
</span><span id="line-1680"></span><span class="annot"><a href="Data.Text.html#lines"><span class="hs-identifier hs-type">lines</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1681"></span><span id="lines"><span class="annot"><span class="annottext">lines :: Text -&gt; [Text]
</span><a href="Data.Text.html#lines"><span class="hs-identifier hs-var hs-var">lines</span></a></span></span><span> </span><span id="local-6989586621679110001"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110001"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110001"><span class="hs-identifier hs-var">ps</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1682"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110000"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; [Text]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109999"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1683"></span><span>                           </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1684"></span><span>                           </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><a href="Data.Text.html#lines"><span class="hs-identifier hs-var">lines</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="Data.Text.Unsafe.html#unsafeTail"><span class="hs-identifier hs-var">unsafeTail</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109999"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1685"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(#</span><span> </span><span id="local-6989586621679110000"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110000"><span class="hs-identifier hs-var">h</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679109999"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109999"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-special">#)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; Text -&gt; (# Text, Text #)
</span><a href="Data.Text.Internal.Private.html#span_"><span class="hs-identifier hs-var">span_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%2F%3D"><span class="hs-operator hs-var">/=</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679110001"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-1686"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#lines"><span class="hs-pragma hs-type">lines</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1687"></span><span>
</span><span id="line-1688"></span><span class="hs-comment">{-
-- | /O(n)/ Portably breaks a 'Text' up into a list of 'Text's at line
-- boundaries.
--
-- A line boundary is considered to be either a line feed, a carriage
-- return immediately followed by a line feed, or a carriage return.
-- This accounts for both Unix and Windows line ending conventions,
-- and for the old convention used on Mac OS 9 and earlier.
lines' :: Text -&gt; [Text]
lines' ps | null ps   = []
          | otherwise = h : case uncons t of
                              Nothing -&gt; []
                              Just (c,t')
                                  | c == '\n' -&gt; lines t'
                                  | c == '\r' -&gt; case uncons t' of
                                                   Just ('\n',t'') -&gt; lines t''
                                                   _               -&gt; lines t'
    where (h,t)    = span notEOL ps
          notEOL c = c /= '\n' &amp;&amp; c /= '\r'
{-# INLINE lines' #-}
-}</span><span>
</span><span id="line-1709"></span><span>
</span><span id="line-1710"></span><span class="hs-comment">-- | /O(n)/ Joins lines, after appending a terminating newline to</span><span>
</span><span id="line-1711"></span><span class="hs-comment">-- each.</span><span>
</span><span id="line-1712"></span><span class="annot"><a href="Data.Text.html#unlines"><span class="hs-identifier hs-type">unlines</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1713"></span><span id="unlines"><span class="annot"><span class="annottext">unlines :: [Text] -&gt; Text
</span><a href="Data.Text.html#unlines"><span class="hs-identifier hs-var hs-var">unlines</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Text
</span><a href="Data.Text.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; Text) -&gt; ([Text] -&gt; [Text]) -&gt; [Text] -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Text) -&gt; [Text] -&gt; [Text]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">L.map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char -&gt; Text
</span><a href="Data.Text.html#snoc"><span class="hs-operator hs-var">`snoc`</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'\n'</span></span><span class="hs-special">)</span><span>
</span><span id="line-1714"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#unlines"><span class="hs-pragma hs-type">unlines</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1715"></span><span>
</span><span id="line-1716"></span><span class="hs-comment">-- | /O(n)/ Joins words using single space characters.</span><span>
</span><span id="line-1717"></span><span class="annot"><a href="Data.Text.html#unwords"><span class="hs-identifier hs-type">unwords</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1718"></span><span id="unwords"><span class="annot"><span class="annottext">unwords :: [Text] -&gt; Text
</span><a href="Data.Text.html#unwords"><span class="hs-identifier hs-var hs-var">unwords</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; Text
</span><a href="Data.Text.html#intercalate"><span class="hs-identifier hs-var">intercalate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; Text
</span><a href="Data.Text.Show.html#singleton"><span class="hs-identifier hs-var">singleton</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">' '</span></span><span class="hs-special">)</span><span>
</span><span id="line-1719"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#unwords"><span class="hs-pragma hs-type">unwords</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1720"></span><span>
</span><span id="line-1721"></span><span class="hs-comment">-- | /O(n)/ The 'isPrefixOf' function takes two 'Text's and returns</span><span>
</span><span id="line-1722"></span><span class="hs-comment">-- 'True' iff the first is a prefix of the second.  Subject to fusion.</span><span>
</span><span id="line-1723"></span><span class="annot"><a href="Data.Text.html#isPrefixOf"><span class="hs-identifier hs-type">isPrefixOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1724"></span><span id="isPrefixOf"><span class="annot"><span class="annottext">isPrefixOf :: Text -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#isPrefixOf"><span class="hs-identifier hs-var hs-var">isPrefixOf</span></a></span></span><span> </span><span id="local-6989586621679109998"><span class="annot"><span class="annottext">a :: Text
</span><a href="#local-6989586621679109998"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679109997"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109997"><span class="hs-identifier hs-var">alen</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679109996"><span class="annot"><span class="annottext">b :: Text
</span><a href="#local-6989586621679109996"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679109995"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109995"><span class="hs-identifier hs-var">blen</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1725"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109997"><span class="hs-identifier hs-var">alen</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C%3D"><span class="hs-operator hs-var">&lt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109995"><span class="hs-identifier hs-var">blen</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Stream Char -&gt; Stream Char -&gt; Bool
forall a. Eq a =&gt; Stream a -&gt; Stream a -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#isPrefixOf"><span class="hs-identifier hs-var">S.isPrefixOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109998"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">stream</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109996"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1726"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#isPrefixOf"><span class="hs-pragma hs-type">isPrefixOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1727"></span><span>
</span><span id="line-1728"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1729"></span><span class="annot"><span class="hs-pragma">&quot;TEXT isPrefixOf -&gt; fused&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679109993"><span class="annot"><a href="#local-6989586621679109993"><span class="hs-pragma hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679109992"><span class="annot"><a href="#local-6989586621679109992"><span class="hs-pragma hs-var">t</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1730"></span><span>    </span><span class="annot"><a href="Data.Text.html#isPrefixOf"><span class="hs-pragma hs-type">isPrefixOf</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109993"><span class="hs-pragma hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109992"><span class="hs-pragma hs-type">t</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#isPrefixOf"><span class="hs-pragma hs-type">S.isPrefixOf</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109993"><span class="hs-pragma hs-type">s</span></a></span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109992"><span class="hs-pragma hs-type">t</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1731"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1732"></span><span>
</span><span id="line-1733"></span><span class="hs-comment">-- | /O(n)/ The 'isSuffixOf' function takes two 'Text's and returns</span><span>
</span><span id="line-1734"></span><span class="hs-comment">-- 'True' iff the first is a suffix of the second.</span><span>
</span><span id="line-1735"></span><span class="annot"><a href="Data.Text.html#isSuffixOf"><span class="hs-identifier hs-type">isSuffixOf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1736"></span><span id="isSuffixOf"><span class="annot"><span class="annottext">isSuffixOf :: Text -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#isSuffixOf"><span class="hs-identifier hs-var hs-var">isSuffixOf</span></a></span></span><span> </span><span id="local-6989586621679109991"><span class="annot"><span class="annottext">a :: Text
</span><a href="#local-6989586621679109991"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109990"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109990"><span class="hs-identifier hs-var">_aarr</span></a></span></span><span> </span><span id="local-6989586621679109989"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109989"><span class="hs-identifier hs-var">_aoff</span></a></span></span><span> </span><span id="local-6989586621679109988"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109988"><span class="hs-identifier hs-var">alen</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679109987"><span class="annot"><span class="annottext">b :: Text
</span><a href="#local-6989586621679109987"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109986"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109986"><span class="hs-identifier hs-var">barr</span></a></span></span><span> </span><span id="local-6989586621679109985"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109985"><span class="hs-identifier hs-var">boff</span></a></span></span><span> </span><span id="local-6989586621679109984"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109984"><span class="hs-identifier hs-var">blen</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1737"></span><span>    </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109983"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109991"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109982"><span class="hs-identifier hs-var">b'</span></a></span><span>
</span><span id="line-1738"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679109983"><span class="annot"><span class="annottext">d :: Int
</span><a href="#local-6989586621679109983"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109984"><span class="hs-identifier hs-var">blen</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109988"><span class="hs-identifier hs-var">alen</span></a></span><span>
</span><span id="line-1739"></span><span>        </span><span id="local-6989586621679109982"><span class="annot"><span class="annottext">b' :: Text
</span><a href="#local-6989586621679109982"><span class="hs-identifier hs-var hs-var">b'</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109983"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109987"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1740"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109986"><span class="hs-identifier hs-var">barr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109985"><span class="hs-identifier hs-var">boff</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109983"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109988"><span class="hs-identifier hs-var">alen</span></a></span><span>
</span><span id="line-1741"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.Text.html#isSuffixOf"><span class="hs-pragma hs-type">isSuffixOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1742"></span><span>
</span><span id="line-1743"></span><span class="hs-comment">-- | /O(n+m)/ The 'isInfixOf' function takes two 'Text's and returns</span><span>
</span><span id="line-1744"></span><span class="hs-comment">-- 'True' iff the first is contained, wholly and intact, anywhere</span><span>
</span><span id="line-1745"></span><span class="hs-comment">-- within the second.</span><span>
</span><span id="line-1746"></span><span class="hs-comment">--</span><span>
</span><span id="line-1747"></span><span class="hs-comment">-- In (unlikely) bad cases, this function's time complexity degrades</span><span>
</span><span id="line-1748"></span><span class="hs-comment">-- towards /O(n*m)/.</span><span>
</span><span id="line-1749"></span><span class="annot"><a href="Data.Text.html#isInfixOf"><span class="hs-identifier hs-type">isInfixOf</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-cpp">
#if defined(ASSERTS)
</span><span>  </span><span class="hs-identifier">HasCallStack</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-cpp">
#endif
</span><span>  </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Bool"><span class="hs-identifier hs-type">Bool</span></a></span><span>
</span><span id="line-1754"></span><span id="isInfixOf"><span class="annot"><span class="annottext">isInfixOf :: Text -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#isInfixOf"><span class="hs-identifier hs-var hs-var">isInfixOf</span></a></span></span><span> </span><span id="local-6989586621679109981"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109981"><span class="hs-identifier hs-var">needle</span></a></span></span><span> </span><span id="local-6989586621679109980"><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109980"><span class="hs-identifier hs-var">haystack</span></a></span></span><span>
</span><span id="line-1755"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109981"><span class="hs-identifier hs-var">needle</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../ghc-prim/src/GHC.Types.html#True"><span class="hs-identifier hs-var">True</span></a></span><span>
</span><span id="line-1756"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Bool
</span><a href="Data.Text.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109981"><span class="hs-identifier hs-var">needle</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; Stream Char -&gt; Bool
</span><a href="Data.Text.Internal.Fusion.Common.html#elem"><span class="hs-identifier hs-var">S.elem</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Char
</span><a href="Data.Text.Unsafe.html#unsafeHead"><span class="hs-identifier hs-var">unsafeHead</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109981"><span class="hs-identifier hs-var">needle</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Stream Char -&gt; Bool) -&gt; (Text -&gt; Stream Char) -&gt; Text -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Stream Char
</span><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-identifier hs-var">S.stream</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Bool) -&gt; Text -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109980"><span class="hs-identifier hs-var">haystack</span></a></span><span>
</span><span id="line-1757"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#not"><span class="hs-identifier hs-var">not</span></a></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Text -&gt; Bool) -&gt; Text -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">L.null</span></a></span><span> </span><span class="annot"><span class="annottext">([Int] -&gt; Bool) -&gt; (Text -&gt; [Int]) -&gt; Text -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Int]
</span><a href="Data.Text.Internal.Search.html#indices"><span class="hs-identifier hs-var">indices</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109981"><span class="hs-identifier hs-var">needle</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Bool) -&gt; Text -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109980"><span class="hs-identifier hs-var">haystack</span></a></span><span>
</span><span id="line-1758"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="annot"><a href="Data.Text.html#isInfixOf"><span class="hs-pragma hs-type">isInfixOf</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1759"></span><span>
</span><span id="line-1760"></span><span class="hs-pragma">{-# RULES</span><span>
</span><span id="line-1761"></span><span class="annot"><span class="hs-pragma">&quot;TEXT isInfixOf/singleton -&gt; S.elem/S.stream&quot;</span></span><span> </span><span class="hs-pragma">[</span><span class="hs-pragma">~</span><span class="hs-pragma">1</span><span class="hs-pragma">]</span><span> </span><span class="hs-pragma">forall</span><span> </span><span id="local-6989586621679109978"><span class="annot"><a href="#local-6989586621679109978"><span class="hs-pragma hs-var">n</span></a></span></span><span> </span><span id="local-6989586621679109977"><span class="annot"><a href="#local-6989586621679109977"><span class="hs-pragma hs-var">h</span></a></span></span><span class="hs-pragma">.</span><span>
</span><span id="line-1762"></span><span>    </span><span class="annot"><a href="Data.Text.html#isInfixOf"><span class="hs-pragma hs-type">isInfixOf</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Show.html#singleton"><span class="hs-pragma hs-type">singleton</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109978"><span class="hs-pragma hs-type">n</span></a></span><span class="hs-pragma">)</span><span> </span><span class="annot"><a href="#local-6989586621679109977"><span class="hs-pragma hs-type">h</span></a></span><span> </span><span class="hs-pragma">=</span><span> </span><span class="annot"><a href="Data.Text.Internal.Fusion.Common.html#elem"><span class="hs-pragma hs-type">S.elem</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109978"><span class="hs-pragma hs-type">n</span></a></span><span> </span><span class="hs-pragma">(</span><span class="annot"><a href="Data.Text.Internal.Fusion.html#stream"><span class="hs-pragma hs-type">S.stream</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109977"><span class="hs-pragma hs-type">h</span></a></span><span class="hs-pragma">)</span><span>
</span><span id="line-1763"></span><span>  </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-1764"></span><span>
</span><span id="line-1765"></span><span class="hs-comment">-------------------------------------------------------------------------------</span><span>
</span><span id="line-1766"></span><span class="hs-comment">-- * View patterns</span><span>
</span><span id="line-1767"></span><span>
</span><span id="line-1768"></span><span class="hs-comment">-- | /O(n)/ Return the suffix of the second string if its prefix</span><span>
</span><span id="line-1769"></span><span class="hs-comment">-- matches the entire first string.</span><span>
</span><span id="line-1770"></span><span class="hs-comment">--</span><span>
</span><span id="line-1771"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1772"></span><span class="hs-comment">--</span><span>
</span><span id="line-1773"></span><span class="hs-comment">-- &gt;&gt;&gt; stripPrefix &quot;foo&quot; &quot;foobar&quot;</span><span>
</span><span id="line-1774"></span><span class="hs-comment">-- Just &quot;bar&quot;</span><span>
</span><span id="line-1775"></span><span class="hs-comment">--</span><span>
</span><span id="line-1776"></span><span class="hs-comment">-- &gt;&gt;&gt; stripPrefix &quot;&quot;    &quot;baz&quot;</span><span>
</span><span id="line-1777"></span><span class="hs-comment">-- Just &quot;baz&quot;</span><span>
</span><span id="line-1778"></span><span class="hs-comment">--</span><span>
</span><span id="line-1779"></span><span class="hs-comment">-- &gt;&gt;&gt; stripPrefix &quot;foo&quot; &quot;quux&quot;</span><span>
</span><span id="line-1780"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1781"></span><span class="hs-comment">--</span><span>
</span><span id="line-1782"></span><span class="hs-comment">-- This is particularly useful with the @ViewPatterns@ extension to</span><span>
</span><span id="line-1783"></span><span class="hs-comment">-- GHC, as follows:</span><span>
</span><span id="line-1784"></span><span class="hs-comment">--</span><span>
</span><span id="line-1785"></span><span class="hs-comment">-- &gt; {-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-1786"></span><span class="hs-comment">-- &gt; import Data.Text as T</span><span>
</span><span id="line-1787"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1788"></span><span class="hs-comment">-- &gt; fnordLength :: Text -&gt; Int</span><span>
</span><span id="line-1789"></span><span class="hs-comment">-- &gt; fnordLength (stripPrefix &quot;fnord&quot; -&gt; Just suf) = T.length suf</span><span>
</span><span id="line-1790"></span><span class="hs-comment">-- &gt; fnordLength _                                 = -1</span><span>
</span><span id="line-1791"></span><span class="annot"><a href="Data.Text.html#stripPrefix"><span class="hs-identifier hs-type">stripPrefix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1792"></span><span id="stripPrefix"><span class="annot"><span class="annottext">stripPrefix :: Text -&gt; Text -&gt; Maybe Text
</span><a href="Data.Text.html#stripPrefix"><span class="hs-identifier hs-var hs-var">stripPrefix</span></a></span></span><span> </span><span id="local-6989586621679109976"><span class="annot"><span class="annottext">p :: Text
</span><a href="#local-6989586621679109976"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109975"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109975"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679109974"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109974"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679109973"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109973"><span class="hs-identifier hs-var">plen</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679109972"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679109972"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109971"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109971"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679109970"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109970"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679109969"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109969"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1793"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109976"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#isPrefixOf"><span class="hs-operator hs-var">`isPrefixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109972"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Maybe Text
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Maybe Text) -&gt; Text -&gt; Maybe Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109971"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109970"><span class="hs-identifier hs-var">off</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109973"><span class="hs-identifier hs-var">plen</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109969"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109973"><span class="hs-identifier hs-var">plen</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1794"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Text
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1795"></span><span>
</span><span id="line-1796"></span><span class="hs-comment">-- | /O(n)/ Find the longest non-empty common prefix of two strings</span><span>
</span><span id="line-1797"></span><span class="hs-comment">-- and return it, along with the suffixes of each string at which they</span><span>
</span><span id="line-1798"></span><span class="hs-comment">-- no longer match.</span><span>
</span><span id="line-1799"></span><span class="hs-comment">--</span><span>
</span><span id="line-1800"></span><span class="hs-comment">-- If the strings do not have a common prefix or either one is empty,</span><span>
</span><span id="line-1801"></span><span class="hs-comment">-- this function returns 'Nothing'.</span><span>
</span><span id="line-1802"></span><span class="hs-comment">--</span><span>
</span><span id="line-1803"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1804"></span><span class="hs-comment">--</span><span>
</span><span id="line-1805"></span><span class="hs-comment">-- &gt;&gt;&gt; commonPrefixes &quot;foobar&quot; &quot;fooquux&quot;</span><span>
</span><span id="line-1806"></span><span class="hs-comment">-- Just (&quot;foo&quot;,&quot;bar&quot;,&quot;quux&quot;)</span><span>
</span><span id="line-1807"></span><span class="hs-comment">--</span><span>
</span><span id="line-1808"></span><span class="hs-comment">-- &gt;&gt;&gt; commonPrefixes &quot;veeble&quot; &quot;fetzer&quot;</span><span>
</span><span id="line-1809"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1810"></span><span class="hs-comment">--</span><span>
</span><span id="line-1811"></span><span class="hs-comment">-- &gt;&gt;&gt; commonPrefixes &quot;&quot; &quot;baz&quot;</span><span>
</span><span id="line-1812"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1813"></span><span class="annot"><a href="Data.Text.html#commonPrefixes"><span class="hs-identifier hs-type">commonPrefixes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">,</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1814"></span><span id="commonPrefixes"><span class="annot"><span class="annottext">commonPrefixes :: Text -&gt; Text -&gt; Maybe (Text, Text, Text)
</span><a href="Data.Text.html#commonPrefixes"><span class="hs-identifier hs-var hs-var">commonPrefixes</span></a></span></span><span> </span><span id="local-6989586621679109968"><span class="annot"><span class="annottext">t0 :: Text
</span><a href="#local-6989586621679109968"><span class="hs-identifier hs-var">t0</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109967"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109967"><span class="hs-identifier hs-var">arr0</span></a></span></span><span> </span><span id="local-6989586621679109966"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109966"><span class="hs-identifier hs-var">off0</span></a></span></span><span> </span><span id="local-6989586621679109965"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109965"><span class="hs-identifier hs-var">len0</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679109964"><span class="annot"><span class="annottext">t1 :: Text
</span><a href="#local-6989586621679109964"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109963"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109963"><span class="hs-identifier hs-var">arr1</span></a></span></span><span> </span><span id="local-6989586621679109962"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109962"><span class="hs-identifier hs-var">off1</span></a></span></span><span> </span><span id="local-6989586621679109961"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109961"><span class="hs-identifier hs-var">len1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Maybe (Text, Text, Text)
</span><a href="#local-6989586621679109960"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1815"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1816"></span><span>    </span><span id="local-6989586621679109960"><span class="annot"><span class="annottext">go :: Int -&gt; Int -&gt; Maybe (Text, Text, Text)
</span><a href="#local-6989586621679109960"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679109959"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679109958"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109965"><span class="hs-identifier hs-var">len0</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3C"><span class="hs-operator hs-var">&lt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109961"><span class="hs-identifier hs-var">len1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679109957"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Char -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679109956"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Maybe (Text, Text, Text)
</span><a href="#local-6989586621679109960"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109955"><span class="hs-identifier hs-var">d0</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109954"><span class="hs-identifier hs-var">d1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1817"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E"><span class="hs-operator hs-var">&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Text, Text, Text) -&gt; Maybe (Text, Text, Text)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109967"><span class="hs-identifier hs-var">arr0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109966"><span class="hs-identifier hs-var">off0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1818"></span><span>                                 </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109967"><span class="hs-identifier hs-var">arr0</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109966"><span class="hs-identifier hs-var">off0</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109965"><span class="hs-identifier hs-var">len0</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-1819"></span><span>                                 </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109963"><span class="hs-identifier hs-var">arr1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109962"><span class="hs-identifier hs-var">off1</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109961"><span class="hs-identifier hs-var">len1</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1820"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Text, Text, Text)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1821"></span><span>      </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679109957"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679109957"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span id="local-6989586621679109955"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109955"><span class="hs-identifier hs-var">d0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109968"><span class="hs-identifier hs-var">t0</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109959"><span class="hs-identifier hs-var">i</span></a></span><span>
</span><span id="line-1822"></span><span>            </span><span class="annot"><a href="Data.Text.Unsafe.html#Iter"><span class="hs-identifier hs-type">Iter</span></a></span><span> </span><span id="local-6989586621679109956"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621679109956"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621679109954"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109954"><span class="hs-identifier hs-var">d1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Int -&gt; Iter
</span><a href="Data.Text.Unsafe.html#iter"><span class="hs-identifier hs-var">iter</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109964"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109958"><span class="hs-identifier hs-var">j</span></a></span><span>
</span><span id="line-1823"></span><span>
</span><span id="line-1824"></span><span class="hs-comment">-- | /O(n)/ Return the prefix of the second string if its suffix</span><span>
</span><span id="line-1825"></span><span class="hs-comment">-- matches the entire first string.</span><span>
</span><span id="line-1826"></span><span class="hs-comment">--</span><span>
</span><span id="line-1827"></span><span class="hs-comment">-- Examples:</span><span>
</span><span id="line-1828"></span><span class="hs-comment">--</span><span>
</span><span id="line-1829"></span><span class="hs-comment">-- &gt;&gt;&gt; stripSuffix &quot;bar&quot; &quot;foobar&quot;</span><span>
</span><span id="line-1830"></span><span class="hs-comment">-- Just &quot;foo&quot;</span><span>
</span><span id="line-1831"></span><span class="hs-comment">--</span><span>
</span><span id="line-1832"></span><span class="hs-comment">-- &gt;&gt;&gt; stripSuffix &quot;&quot;    &quot;baz&quot;</span><span>
</span><span id="line-1833"></span><span class="hs-comment">-- Just &quot;baz&quot;</span><span>
</span><span id="line-1834"></span><span class="hs-comment">--</span><span>
</span><span id="line-1835"></span><span class="hs-comment">-- &gt;&gt;&gt; stripSuffix &quot;foo&quot; &quot;quux&quot;</span><span>
</span><span id="line-1836"></span><span class="hs-comment">-- Nothing</span><span>
</span><span id="line-1837"></span><span class="hs-comment">--</span><span>
</span><span id="line-1838"></span><span class="hs-comment">-- This is particularly useful with the @ViewPatterns@ extension to</span><span>
</span><span id="line-1839"></span><span class="hs-comment">-- GHC, as follows:</span><span>
</span><span id="line-1840"></span><span class="hs-comment">--</span><span>
</span><span id="line-1841"></span><span class="hs-comment">-- &gt; {-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-1842"></span><span class="hs-comment">-- &gt; import Data.Text as T</span><span>
</span><span id="line-1843"></span><span class="hs-comment">-- &gt;</span><span>
</span><span id="line-1844"></span><span class="hs-comment">-- &gt; quuxLength :: Text -&gt; Int</span><span>
</span><span id="line-1845"></span><span class="hs-comment">-- &gt; quuxLength (stripSuffix &quot;quux&quot; -&gt; Just pre) = T.length pre</span><span>
</span><span id="line-1846"></span><span class="hs-comment">-- &gt; quuxLength _                                = -1</span><span>
</span><span id="line-1847"></span><span class="annot"><a href="Data.Text.html#stripSuffix"><span class="hs-identifier hs-type">stripSuffix</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1848"></span><span id="stripSuffix"><span class="annot"><span class="annottext">stripSuffix :: Text -&gt; Text -&gt; Maybe Text
</span><a href="Data.Text.html#stripSuffix"><span class="hs-identifier hs-var hs-var">stripSuffix</span></a></span></span><span> </span><span id="local-6989586621679109953"><span class="annot"><span class="annottext">p :: Text
</span><a href="#local-6989586621679109953"><span class="hs-identifier hs-var">p</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109952"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109952"><span class="hs-identifier hs-var">_arr</span></a></span></span><span> </span><span id="local-6989586621679109951"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109951"><span class="hs-identifier hs-var">_off</span></a></span></span><span> </span><span id="local-6989586621679109950"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109950"><span class="hs-identifier hs-var">plen</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621679109949"><span class="annot"><span class="annottext">t :: Text
</span><a href="#local-6989586621679109949"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109948"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109948"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679109947"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109947"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679109946"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109946"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1849"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109953"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Bool
</span><a href="Data.Text.html#isSuffixOf"><span class="hs-operator hs-var">`isSuffixOf`</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679109949"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Maybe Text
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Maybe Text) -&gt; Text -&gt; Maybe Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24%21"><span class="hs-operator hs-var">$!</span></a></span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109948"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109947"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109946"><span class="hs-identifier hs-var">len</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109950"><span class="hs-identifier hs-var">plen</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1850"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Text
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1851"></span><span>
</span><span id="line-1852"></span><span class="hs-comment">-- | Add a list of non-negative numbers.  Errors out on overflow.</span><span>
</span><span id="line-1853"></span><span class="annot"><a href="Data.Text.html#sumP"><span class="hs-identifier hs-type">sumP</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span>
</span><span id="line-1854"></span><span id="sumP"><span class="annot"><span class="annottext">sumP :: String -&gt; [Int] -&gt; Int
</span><a href="Data.Text.html#sumP"><span class="hs-identifier hs-var hs-var">sumP</span></a></span></span><span> </span><span id="local-6989586621679109945"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109945"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Int] -&gt; Int
</span><a href="#local-6989586621679109944"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1855"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679109944"><span class="annot"><span class="annottext">go :: Int -&gt; [Int] -&gt; Int
</span><a href="#local-6989586621679109944"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">!</span><span id="local-6989586621679109943"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109943"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679109942"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109942"><span class="hs-identifier hs-var">x</span></a></span></span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-type">:</span></a></span><span id="local-6989586621679109941"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679109941"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1856"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109940"><span class="hs-identifier hs-var">ax</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3E%3D"><span class="hs-operator hs-var">&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Int] -&gt; Int
</span><a href="#local-6989586621679109944"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109940"><span class="hs-identifier hs-var">ax</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679109941"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-1857"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall a. String -&gt; a
</span><a href="Data.Text.html#overflowError"><span class="hs-identifier hs-var">overflowError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109945"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1858"></span><span>          </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679109940"><span class="annot"><span class="annottext">ax :: Int
</span><a href="#local-6989586621679109940"><span class="hs-identifier hs-var hs-var">ax</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109943"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109942"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1859"></span><span>        </span><span class="annot"><a href="#local-6989586621679109944"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621679109939"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109939"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="annot"><span class="annottext">[Int]
</span><span class="hs-identifier">_</span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109939"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1860"></span><span>
</span><span id="line-1861"></span><span id="local-6989586621679109938"><span class="annot"><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-type">emptyError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679109938"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1862"></span><span id="emptyError"><span class="annot"><span class="annottext">emptyError :: forall a. String -&gt; a
</span><a href="Data.Text.html#emptyError"><span class="hs-identifier hs-var hs-var">emptyError</span></a></span></span><span> </span><span id="local-6989586621679109935"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109935"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">P.error</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; a) -&gt; String -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.Text.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109935"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: empty input&quot;</span></span><span>
</span><span id="line-1863"></span><span>
</span><span id="line-1864"></span><span id="local-6989586621679111233"><span class="annot"><a href="Data.Text.html#overflowError"><span class="hs-identifier hs-type">overflowError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679111233"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1865"></span><span id="overflowError"><span class="annot"><span class="annottext">overflowError :: forall a. String -&gt; a
</span><a href="Data.Text.html#overflowError"><span class="hs-identifier hs-var hs-var">overflowError</span></a></span></span><span> </span><span id="local-6989586621679109932"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109932"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; a
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">P.error</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; a) -&gt; String -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Data.Text.&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679109932"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;: size overflow&quot;</span></span><span>
</span><span id="line-1866"></span><span>
</span><span id="line-1867"></span><span class="hs-comment">-- | /O(n)/ Make a distinct copy of the given string, sharing no</span><span>
</span><span id="line-1868"></span><span class="hs-comment">-- storage with the original string.</span><span>
</span><span id="line-1869"></span><span class="hs-comment">--</span><span>
</span><span id="line-1870"></span><span class="hs-comment">-- As an example, suppose you read a large string, of which you need</span><span>
</span><span id="line-1871"></span><span class="hs-comment">-- only a small portion.  If you do not use 'copy', the entire original</span><span>
</span><span id="line-1872"></span><span class="hs-comment">-- array will be kept alive in memory by the smaller string. Making a</span><span>
</span><span id="line-1873"></span><span class="hs-comment">-- copy \&quot;breaks the link\&quot; to the original array, allowing it to be</span><span>
</span><span id="line-1874"></span><span class="hs-comment">-- garbage collected if there are no other live references to it.</span><span>
</span><span id="line-1875"></span><span class="annot"><a href="Data.Text.html#copy"><span class="hs-identifier hs-type">copy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span>
</span><span id="line-1876"></span><span id="copy"><span class="annot"><span class="annottext">copy :: Text -&gt; Text
</span><a href="Data.Text.html#copy"><span class="hs-identifier hs-var hs-var">copy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-type">Text</span></a></span><span> </span><span id="local-6989586621679109931"><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109931"><span class="hs-identifier hs-var">arr</span></a></span></span><span> </span><span id="local-6989586621679109930"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109930"><span class="hs-identifier hs-var">off</span></a></span></span><span> </span><span id="local-6989586621679109929"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109929"><span class="hs-identifier hs-var">len</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Array -&gt; Int -&gt; Int -&gt; Text
</span><a href="Data.Text.Internal.html#Text"><span class="hs-identifier hs-var">Text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(forall s. ST s (MArray s)) -&gt; Array
</span><a href="Data.Text.Array.html#run"><span class="hs-identifier hs-var">A.run</span></a></span><span> </span><span class="annot"><span class="annottext">forall s. ST s (MArray s)
</span><a href="#local-6989586621679109928"><span class="hs-identifier hs-var">go</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109929"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1877"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1878"></span><span>    </span><span id="local-6989586621679109927"><span class="annot"><a href="#local-6989586621679109928"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.ST.html#ST"><span class="hs-identifier hs-type">ST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109927"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Text.Array.html#MArray"><span class="hs-identifier hs-type">A.MArray</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679109927"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-1879"></span><span>    </span><span id="local-6989586621679109928"><span class="annot"><span class="annottext">go :: forall s. ST s (MArray s)
</span><a href="#local-6989586621679109928"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1880"></span><span>      </span><span id="local-6989586621679109923"><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679109923"><span class="hs-identifier hs-var">marr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ST s (MArray s)
forall s. Int -&gt; ST s (MArray s)
</span><a href="Data.Text.Array.html#new"><span class="hs-identifier hs-var">A.new</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109929"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1881"></span><span>      </span><span class="annot"><span class="annottext">MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
forall s. MArray s -&gt; Int -&gt; Array -&gt; Int -&gt; Int -&gt; ST s ()
</span><a href="Data.Text.Array.html#copyI"><span class="hs-identifier hs-var">A.copyI</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679109923"><span class="hs-identifier hs-var">marr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Array
</span><a href="#local-6989586621679109931"><span class="hs-identifier hs-var">arr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109930"><span class="hs-identifier hs-var">off</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679109929"><span class="hs-identifier hs-var">len</span></a></span><span>
</span><span id="line-1882"></span><span>      </span><span class="annot"><span class="annottext">MArray s -&gt; ST s (MArray s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">MArray s
</span><a href="#local-6989586621679109923"><span class="hs-identifier hs-var">marr</span></a></span><span>
</span><span id="line-1883"></span><span>
</span><span id="line-1884"></span><span>
</span><span id="line-1885"></span><span class="hs-comment">-------------------------------------------------</span><span>
</span><span id="line-1886"></span><span class="hs-comment">-- NOTE: the named chunk below used by doctest;</span><span>
</span><span id="line-1887"></span><span class="hs-comment">--       verify the doctests via `doctest -fobject-code Data/Text.hs`</span><span>
</span><span id="line-1888"></span><span>
</span><span id="line-1889"></span><span class="hs-comment">-- $setup</span><span>
</span><span id="line-1890"></span><span class="hs-comment">-- &gt;&gt;&gt; :set -XOverloadedStrings</span><span>
</span><span id="line-1891"></span><span class="hs-comment">-- &gt;&gt;&gt; import qualified Data.Text as T</span><span>
</span><span id="line-1892"></span></pre></body></html>